[Microservices] Technology selection and components of microservice architecture

1. Insufficiency of the traditional monolithic architecture
(1) The complexity of the application increases, and it is difficult to update and maintain
(2) It is easy to cause waste of system resources
(3) It affects the development efficiency (
4) The application reliability is low
(5) It is not conducive to the development of technology Update
2. How to solve the problem of the traditional monolithic architecture
First put forward SOA (Service-Orinted Architect, service-oriented architecture): aggregate similar functions in the application and provide them in the form of services.
Because SOA also has deficiencies, the idea of ​​microservice architecture is proposed. Microservices split the business functions of the system into more fine-grained services, and each split service is an independent application. A series of architectures (including development, testing, integration, etc.) built around the idea of ​​microservices are called "microservice architecture".
3. Advantages of microservice architecture
(1) Controllable complexity
(2) Independent deployment (3
) Flexible technology selection
(4) Easy to fault tolerance
(5) Easy to expand
(6) Function specific
4. Insufficiency of microservice architecture
( 1) Developers have to deal with the complexity of creating a distributed system
(2) The complexity of deployment
(3) Increased memory consumption
5. The difference between microservice architecture and SOA

microservice architecture SOA
A system is split into multiple services, fine-grained Services are composed of multiple subsystems, fine-grained
Team-level, bottom-up implementation Enterprise-level, top-down implementation
No centralized bus, loose service architecture Enterprise service bus, centralized service architecture
Simple integration (HTTP/REST/JSON) Complex integration methods (ESB/WS/SOAP)
Services can be deployed independently Services depend on each other and cannot be deployed independently

6. Components of the microservice architecture
(1) Service registry : the place where all services in the system are registered.
(2) Service registration : The service provider registers its call address to the service registration center, so that the service caller can find itself conveniently.
(3) Service discovery : The service caller finds the address that he needs to call the service from the service registration center.
(4) Load balancing : Service providers generally provide services in the form of instances, and using load balancing can ensure that service callers are connected to appropriate service nodes.
(5) Service fault tolerance : Through a series of service protection mechanisms such as circuit breakers (also known as fuses), service callers are guaranteed to return results quickly when calling abnormal services, avoiding a large number of synchronous waiting.
(6) Service Gateway : Also known as API Gateway, it is the only entrance for service calls. Functions such as user authentication, dynamic routing, grayscale release, and load current limiting can be realized in this component.
(7) Distributed configuration center : Register localized configuration information (properties, yml, yaml, etc.) to the configuration center to realize the indiscrimination of the program package in the development, test, and production environments, and facilitate the migration of the program package.
7. Technology selection of microservice architecture
insert image description here
(1) Development of microservice instances : Spring Boot
(2) Service registration and discovery : Spring Cloud Eureka, Zoopeper, Consul, Dubbo, etc.
(3) Load balancing : Spring Cloud Ribbon and Dubbon Etc.
(4) Service Fault Tolerance : Hystrix
(5) API Gateway: Spring Cloud Zuul, Netty or NodeJS, etc.
(6) Distributed configuration center : Spring Cloud Config
(7) Debugging : Swagger (is one of the most popular REST API document generation tools, it provides a powerful page testing function to Debug each RESTful API)
(8) Deployment : Docker (Docker is an open source application container engine with portability and fast startup speed, suitable for running some lightweight applications) (9)
Continuous integration : Jenkins build automation Deploy the system and use Docker for container packaging.
insert image description here
The microservice architecture is updated faster, and the technology selection is constantly iterating. Currently, the commonly used technology selection in SpringCloud is as follows:
insert image description here
a complete project consists of multiple microservices, and each service will Access your own database. When these services are started, their information will be registered in the service registration center . When the client sends a request, the request will be intercepted by the API gateway first , and the API gateway will read the request data and obtain the corresponding service information from the registration center , and then The API gateway will call the required microservices according to the service information.

Guess you like

Origin blog.csdn.net/weixin_46081857/article/details/123412677