1. History of Service Architecture
- Existing Service Framework: Monolithic Architecture
- Concept: develop all business functions in one project, package and deploy
- Advantages: simple architecture, low deployment cost
- Disadvantage: high coupling
- distributed architecture
- Concept: Split the system according to business functions, each business module is developed as an independent project, called a service
- Advantages: low coupling, high scalability
- Defect: Cannot request scheduling across servers
- Several issues that need to be considered in distributed architecture
- Service Split Precision
- Service cluster address maintenance
- calls between services
- Service Health Check
2. Microservices
(1) Concept: Microservice is a distributed architecture solution with well-designed architecture.
(2) Microservice Architecture Features:
- 1. Single responsibility: The granularity of microservice splitting is small, and each service corresponds to a unique business, avoiding repeated business development.
- 2. Service-oriented: Microservices expose business interfaces to the outside world.
- 3. Autonomy: independent team, independent technology, independent data, independent deployment
(3) Comparison of microservice structure
Dubbo | SpringCloud | SpringCloudAlibaba | |
---|---|---|---|
registration center | zookeeper、Redis | Euraka, Consul | Nacos、Eureka |
Service remote call | Dubbo protocol | Feign (http protocol) | Dubbo、Feign |
configuration center | none | SpringCloudConfig | SpringCloudConfig、Nacos |
service gateway | none | SpringCloudGateway、Zuul | SpringCloudGateway、zuul |
Service Monitoring and Protection | dubbo-admin | Hystrix | Sentinel |
三、SpringCloud
(1) Concept: SpringCloud is currently the most widely used microservice framework in China. It integrates various microservice functional components, and realizes automatic assembly of components based on SpringBoot, providing an out-of-the-box experience.
(2) Official address: https://spring.io/projects/spring-cloud
(3) SpringCloud is compatible with SpringBoot versions
4. Providers and consumers
- What are providers and consumers?
- Service provider: a service that is invoked by other microservices. (basically every microservice is a service provider)
- Service consumer: a service that calls other microservices. (microservices that call interfaces)