The first thing to know is that Spring Cloud is a microservices architecture.
Microservice architecture is an architectural model that divides a single application into a set of very small services, and the services coordinate and cooperate with each other. Each service runs in a separate process, using a lightweight communication mechanism between services (usually HTTP protocol RESTful API). Each service has its own business, and can be independently deployed to production environment, production-like environment, etc. For a specific service, it should be based on the context, select the appropriate language, tools to build it.
Spring Cloud is a microservice architecture, which includes the following functions:
Service registration and discovery, service invocation, service fuse, load balancing, service degradation, service message queue, configuration center management, service gateway, service monitoring, full link tracking, automated construction and deployment, service timing tasks.
However, only the following types are generally used in the project:
Service registration and discovery: EUREKA
Service load and call: NETFLIX OSS RIBBON, NETFLIX FEIGN
Service fuse degradation: HYSTRIX
Service Gateway: NETFLIX Zuul
Server distributed configuration: Spring Coloud Config
Service development: Spring Boot
Let's take a look at the official analysis
Cloud
The development of distributed systems is challenging for general systems. The communication between services is closer, and Cloud shifts the focus of the project from the application layer to the network layer. The code needs 12 factors to connect to the Cloud service, such as configuration files, status, logs, and services connected to the back end. Spring Cloud provides these sets of services to enable developers' program services to run on the cloud.
Spring Cloud architecture
The picture is as follows:
Service discovery
In the cloud, applications will only know about services on other hosts except local services. However, Netflix Eureka and or HashiCorp Consul can use local services to know about the problems of services on other hosts. Spring Boot provides DiscoveryClient to implement services for Eureka, Consul, Zookeeper, and Kubernetes system registration.
API gateway
The services on the Cloud all rely on the API gateway to maintain its security, service hiding, and load regulation.
Cloud configuration
In cloud, configuration files are often used in a set of environments or systems or several applications, rather than in a single application. Spring Cloud Config is used to provide these help.
Tracing
The debugging of distributed applications is more complicated, and it is determined that the failure requires several independent services to run and locate together. Spring Cloud Sleuth can test applications.