Eureka and Ribbon and Hystrix and zuul

Springcloud and Dubbo difference?
  Spring Cloud abandoned Dubbo RPC communication, using the REST HTTP-based manner.

eureka zookeeper and can provide service registration and discovery features, please talk about the difference between the two (advantage)?   

zookeeper: When the primary node fails, zk will select the remaining nodes master node takes too long, though eventually recover, but during the selected master node causes the service is not available, this can not be tolerated. eureka: each node is equal, hang a node, the other nodes will ensure normal service.

Summary: The famous CAP theory states that a distributed system can not satisfy C (consistency), A (availability) and P (partitions fault tolerance). Since the partition
region P in a distributed fault-tolerant system must be guaranteed, so we can only trade-off between A and C. Therefore, Zookeeper ensure
that CP, Eureka is the AP.

Eureka There is also a self-protection mechanism?

Eureka Client: This information service is responsible for the registration to Eureka Server

Eureka Server: registration center, which has a registry, save the machine where each service and port number

First eureka client 30 to eureka server server sends a heartbeat within 15 minutes more than 85% of the nodes are not normal heartbeat, then the client is considered Eureka and registration center of a network failure, the following appears every situation :

1, Eureka no longer remove because for a long time and should not receive heartbeat expired registration service from the list

2, Eureka still able to accept registration and query requests for new services, but will not be synchronized to (that is, to ensure that the current node is still available) on other nodes.

3, when the network is stable, the current instance of the new registration information will be synchronized to the other nodes Therefore, Eureka can well cope with the situation due to network failure resulting in some nodes lost contact, but not as paralysis of the entire registration services like zookeeper .

Ribbon and Nginx difference?

1, Ribbon client load balancing tools, and client load balancing and server load balancing biggest difference is the service list stored position, the client load balancing, server list at all client nodes need themselves available on the service registry, such as Eureka service registry. Similar to the server load balancing architecture, load balancing at the client also needs to maintain heart health of the server list, but with the completion of this step requires registration with the service center.

2, in Spring Cloud, because of the Ribbon Spring Cloud made a second package, the default configuration for automation integration will create the Ribbon.
3, in the Spring Cloud, Ribbon main target and together with RestTemplate use, Ribbon will be automated configuration RestTemplate objects, open load balancing when RestTemplate object calls by @LoadBalanced.

Ribbon realize how client load balancing?

Since the Spring Cloud Ribbon package, we use client load balancing call micro-services architecture is very simple, just two steps as follows

1, start the instance of multiple service providers and sign up to a service registry or service registration center cluster
2, the service consumer to invoke the service provider is @LoadBalanced annotated by a modified RestTemplate.
In this way, we can achieve a service provider of high availability and load balancing service consumer calls.

Four filter Zuul's?

(1) PRE: This filter is called before the request is routed. We can use this filter for authentication, select the request in the cluster micro service record debugging information.

(2) ROUTING: This filter is used to construct the service request to the micro, and or using Apache HttpClient Netfilx Ribbon micro service request.

(3) POST: This filter is performed after the service is routed to the micro. Such a filter response may be used to add standard HTTP Header, collecting statistics and indicators, the response is sent from the micro-services to clients.

(4) ERROR: the implementation of the filter when the other phase error.

 Hystrix role?

Related Links: https://www.jianshu.com/p/aa79fb6d96f3

If a service call another user Inventory Service, an inventory service hung up. Users can access the service, but the service time will adjust inventory error. The card will be a few minutes.

This time to make a direct blow service, inventory service request within a few minutes directly fallback return an exception page.

Service differentiation fuse and service degradation?

  Services fuse: usually caused by an abnormal service, equivalent to "fuse" when an exception condition is triggered, directly fuse the entire service, return, and so this is not a service timeout.

         By @HystrixCommand (fallbackMethod = "hystrix_GET") // find alternative responses, for service downgrading

    Service degradation: downgraded from a whole load is generally considered, when a service is blown, the server will no longer be called, a client can prepare their own local fallback callback returns a default value, although service levels drop, when use , stronger than hang directly.

 

Guess you like

Origin www.cnblogs.com/lgg20/p/12343959.html