0 x01: springcloud

Springcloud is the epitome of a microservices architecture that integrates a number of excellent components. Built on SpringBoot, it is easier for us programmers familiar with Spring to get started. Bytes.

With a few simple annotations, we can quickly configure common modules in the application and build large distributed systems.

SpringCloud’s components are quite complex, with many subprojects. Focus on Netflix

Release notes for SpringCloud:

A SpringCloud project is a collection of multiple independent projects, each of which is independent and does its own iteration and release. So instead of using version numbers, springcloud uses version names. To avoid conflicts with subproject version numbers.

The name of the edition is derived from the names of London underground stations, in alphabetical order. For example, the first Release was Angel and the second Release was Brixton.

When updates to a version accumulate or a serious bug is resolved, a ServiceRelease, SR, is released, followed by the number for the first release under that major release.

According to the official website, springCloud version F is based on SpringBoot 2.0.x, and the previous version is based on SpringBoot 1.5.x

0x02: Describes the next five common components

Service Discovery — Netflix Eureka Customer service load Balancing — Netflix Ribbon Circuit Breaker — Netflix Hystrix Service Gateway — Netflix Zuul Distributed Configuration — Spring Cloud Config

Eureka

Role: Service governance (service registration and discovery)

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

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

The Eureka server serves as a service registry. Cluster deployment is supported.

The Eureka client is a Java client that handles service registration and discovery.

When the application starts, the Eureka client registers its service information with the server and caches the service information locally. The client periodically communicates with the server to update the service lease and service information.

Ribbon

Role: The Ribbon provides client-side software load balancing algorithms.

Spring Cloud Ribbon is a client load balancing tool based on HTTP and TCP. It is implemented by Netflix Ribbon. The encapsulation of Spring Cloud makes it easy to automatically convert service-oriented REST template requests into client-side load-balancing service invocations.

Notice in the figure above that the key point is to convert external REST calls into microservice calls based on load balancing policies. The Ribbon has a lot of load balancing strategies that we’ll cover in the future.

Hystrix

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

Summary: To ensure high availability, individual services are usually deployed in clusters. Due to network reasons or its own reasons, the service cannot guarantee 100% availability. If a single service has problems, the invocation of this service will be blocked. At this time, if a large number of requests flood in, the thread resources of the Servlet container will be consumed and the service will break down. The “avalanche” effect of service failures is the spread of service-to-service dependencies, which can have catastrophic consequences for the entire microservice system.

Zuul

Functions: API gateway, routing, load balancing and other functions

Summary: Nginx-like, reverse proxy functionality, but Netflix has added some features to work with other components.

In microservices architecture, back-end services are often not directly open to the calling side, but routed to the corresponding service through an API gateway based on the requested URL. When the API gateway is added, a wall is created between the third party caller and the service provider. This wall communicates directly with the caller for permission control, and then distributes requests evenly to the background server.

Config

Function: Configuration management

Summary: SpringCloud Config provides both server-side and client-side services. The default implementation of the server storage back uses Git, so it easily supports a tabbed version of the configuration environment, as well as access to a variety of tools for managing content.

This is still static and needs to work with The Spring Cloud Bus for dynamic configuration updates.

This article turns to music bytes.