Five major components of springcloud: 1. Eureka implements service governance; 2. Ribbon mainly provides client-side software load balancing algorithms; 3. Hystrix circuit breaker, protection system, and control fault scope; 4. Zuul, api gateway, Routing, load balancing and other functions; 5. Config configuration management.
The operating environment of this article: windows10 system, spring cloud 2.4.x, thinkpad t480 computer.
Five major components of springcloud:
1, Eureka
Role: Implement services Governance (service registration and discovery)
Introduction: Spring Cloud Eureka is the service governance module under the Spring Cloud Netflix project.
consists of two components: Eureka server and Eureka client.
The Eureka server is used as a service registration center. Support cluster deployment.
Eureka client is a java client used to handle service registration and discovery.
When the application starts, the Eureka client registers its own service information with the server and caches the server's service information locally. The client will periodically conduct heartbeat interactions with the server to update service leases and service information.
2. Ribbon
Function: Ribbon mainly provides client-side software load balancing algorithms.
Introduction: Spring Cloud Ribbon is a client-side load balancing tool based on HTTP and TCP, which is implemented based on Netflix Ribbon. Through Spring Cloud's encapsulation, we can easily automatically convert service-oriented REST template requests into client-side load-balanced service calls.
Look at the picture above. The key point is to convert external REST calls into microservice calls according to the load balancing strategy. Ribbon has many load balancing strategies, which will be explained later.
3. Hystrix
Function: circuit breaker, protection system, control fault scope.
Introduction: In order to ensure its high availability, a single service is usually deployed in a cluster. Due to network reasons or its own reasons, the service cannot guarantee 100% availability. If there is a problem with a single service, thread blocking will occur when calling this service. At this time, if a large number of requests pour in, the thread resources of the Servlet container will be consumed. , causing service paralysis. Due to the dependencies between services, faults will propagate and have catastrophic consequences for the entire microservice system. This is the "avalanche" effect of service failures.
4. Zuul
Function: api gateway, routing, load balancing and other functions
Introduction : Similar to nginx, reverse proxy function, but Netflix itself has added some features to cooperate with other components.
In the microservice architecture, back-end services are often not directly open to the calling end, but are routed to the corresponding service through an API gateway based on the requested URL. When an API gateway is added, a wall is created between the third-party caller and the service provider. This wall directly communicates with the caller for permission control, and then distributes requests to the backend server in a balanced manner.
5. Config
Function: Configuration management
Introduction: SpringCloud Config provides server and client . The default implementation of the server storage backend uses git, so it easily supports a tagged version of the configuration environment, as well as providing access to a variety of tools for managing content.
This is still static and must be coordinated with Spring Cloud Bus to achieve dynamic configuration updates.
The above is the detailed content of What are the five major components of springcloud. For more information, please follow other related articles on the PHP Chinese website!