This is the 9th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021

SpringCloud

What are microservices

Microservice is to divide an application into multiple applications, which are called microservices. Each microservice runs in its own independent process and uses lightweight communication mechanism. These services are separated according to services and deployed independently

What is SpringCloud

SpringCloud is an ordered collection of frameworks. The development convenience of using Springboot simplifies the development of distributed system infrastructure, such as service discovery registration, configuration center, intelligent routing, message bus, load balancing, circuit breakers, data monitoring, etc. All can use Springboot development style.

SpringCloud did not repeat the wheels, it will only companies to develop more mature, stand the test of actual service framework, again through the SpringBoot style packaging, shielding the complex configuration and implementation principle, finally give developers a set of simple, easy to deploy, easy to maintenance of the distributed system development kit

Advantages and disadvantages of SpringCloud

advantages

1. Low coupling degree. The development of other modules will not be affected.

2. Reduce the cost of the team, can develop in parallel, do not worry about how others develop, focus on their own development first.

3. The configuration is relatively simple, basically can be achieved with annotations, do not use too many configuration files.

4. Microservices are cross-platform and can be developed in any language.

5. Each microservice can have its own independent database as well as a public database.

6. Directly write back-end code, do not pay attention to the front-end development, directly write your own back-end code, and then expose the interface, through the component for service communication

disadvantages

1. The deployment is cumbersome, which causes problems for O&M engineers.

2. Data management is more troublesome because microservices can use one database per microservice.

3. System integration test is troublesome

4. Performance monitoring is difficult. Better to develop a large screen monitoring system

The difference between SpringBoot and SpringCloud

  • SpringBoot focuses on developing individual services quickly and easily

  • SpringCloud is a global microservices coordination governance framework that integrates and manages individual services developed by SpringBoot

  • Provides configuration management, service discovery, circuit breakers, routing, microproxy, event bus, global locking, decision campaigns, distributed sessions, and more between microservices

  • SpringBoot can use development projects independently of SpringCloud, but SpringCloud cannot do without SpringBoot.

Mapping between SpringCloud and SpringBoot versions

Spring Cloud Version Spring Boot Version
Hoxton X 2.2.
Greenwich X 2.1.
Finchley X 2.0.
Edgware X 1.5.
Dalston X 1.5.

Important components of SpringCloud

  • Spring Cloud Eureka: Service registration and discovery

  • Spring Cloud Zuul: Service gateway

  • Spring Cloud Ribbon: Server-side load balancing

  • Spring Cloud Feign: Declarative Web services client

  • Spring Cloud Hystrix: Circuit breaker

  • Spring Cloud Config: Distributed unified configuration management

The difference between SpringCloud and Dubbo

  1. Service invocation: Dubbo is RPC and SpringCloud is Rest Api

  2. Registries: Dubbo is ZooKeeper, SpringCloud is Eureka and can also be ZooKeeper

  3. Service Gateway: Dubbo itself is not implemented, but can only be integrated through other third-party technologies. Springcloud has Zuul routing gateway, which acts as routing server for consumer request distribution. Springcloud supports circuit breakers, perfect integration with Git configuration files to support version control. The transaction bus implements a series of microservice architecture elements such as configuration file update and automatic service assembly.