springcloud basic theory study three

Reference to reprint the original link: https://baijiahao.baidu.com/s?id=1621651597363566701&wfr=spider&for=pc

springcloud

Springcloud is a master of microservice architecture, integrating a series of excellent components. Based on springboot, it is easier for programmers who are familiar with spring to get started.

With some simple annotations, we can quickly configure common modules in the application and build a huge distributed system.

The components of SpringCloud are quite complex and have many sub-projects. Focus on Netflix

Image source @王璐-Louise. I can't draw such a beautiful picture. . .

Release notes for springcloud:

The springcloud project is a collection of multiple independent projects, each of which is independent and carries out its own iteration and version release. So springcloud is not convenient to use the version number to manage, but uses the version name. To avoid conflicts with sub-project version numbers.

 

The source of the version name is the London Underground station names, sorted alphabetically. For example, the earliest Release version is Angel, and the second Release version is Brixton.

When a version of the update accumulates more or solves a serious bug, a ServiceRelease version, referred to as SR, will be released. The number behind it is the first release under the major version.

From the official website, the F version of springcloud is based on springboot 2.0.x, and the previous one is based on springboot 1.5.x.

The following only briefly introduces the 5 frequently used

Service discovery-Netflix Eureka

Client load balancing-Netflix Ribbon

Circuit Breaker-Netflix Hystrix

Service Gateway-Netflix Zuul

Distributed configuration-Spring Cloud Config

Eureka

Role: Realize service governance (service registration and discovery)

Introduction: Spring Cloud Eureka is a service governance module under the Spring Cloud Netflix project.

It consists of two components: Eureka server and Eureka client.

The Eureka server serves as the service registry. 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 at the same time caches the service information of the server locally. The client and the server periodically exchange heartbeats to update the service lease and service information.

 

Ribbon

Role: 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 encapsulation, we can easily convert service-oriented REST template requests into client-side load balancing service calls.

Pay attention to the above picture. The key point is to convert the rest call from the outside into a microservice call according to the load balancing strategy. Ribbon has more load balancing strategies, which will be explained later.

 

 

Hystrix

Function: circuit breaker, protection system, control fault range.

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 is not guaranteed to be 100% available. If a single service has a problem, thread blocking will occur when calling this service. If a large number of requests flow in at this time, the thread resources of the Servlet container will be consumed. , Resulting in service paralysis. The dependency between service and service, failure will propagate, and will cause catastrophic and serious consequences to the entire microservice system. This is the "avalanche" effect of service failure.

 

 

 

Zuul

Function: api gateway, routing, load balancing and other functions

Introduction: Similar to nginx, reverse proxy function, but netflix has added some features to cooperate with other components.

In the microservice architecture, back-end services are often not directly open to the caller, but are routed to the corresponding service through an API gateway according to the requested URL. When the 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 evenly distributes the requests to the background server.

Config

Role: configuration management

Introduction: SpringCloud Config provides server-side and client-side. The default implementation of the server storage backend uses git, so it easily supports the configuration environment of the tag version and can access various tools for managing content.

This is still static, and needs to cooperate with Spring Cloud Bus to achieve dynamic configuration updates.

Guess you like

Origin blog.csdn.net/qq_30764991/article/details/100537356