During the weekend, I took advantage of the break, and learned about the weather system of XiaMucao.com, and took the opportunity to summarize the advantages and disadvantages of the single-block architecture and microservices, which is convenient for future reading
Advantages and disadvantages of monolithic architecture
advantage
Disadvantage
Clear function division
Too much function, too complicated
Good hierarchical relationship
High risk of upgrading the system
Each layer is independent
Increased maintenance costs
Single technology (low cost, suitable for full stack development)
Lead time
Simple to deploy
Poor scalability
Simple to deploy
Difficulty in monitoring (when there is a problem with the system, it is difficult to detect which part of the problem is wrong)
How to design a microservice system
the way
Introduction
Service split
Split the service into small and precise, such as collection service, data cleaning service, etc.
Service registration
Register the service to the registration center to allow other services to be consumed
Service discovery
When the service calls other services, you can view the service registry and call the service interface by name
Service consumption
Call other services, called consumer services, callers are called consumers, providers are also called suppliers
Unified entrance
There are more services, you can have a unified entrance, and you can call it directly through the unified entrance
Configuration management
Through the configuration management platform, the configuration process can be simplified
Fuse mechanism
Fuse is the protection mechanism of the system. In the case of high concurrency, services are piled up, and fuse can be used to block all requests, greatly reducing the possibility of service crash
Automatic expansion
The service is automatically expanded according to the current situation. For example, ten hosts and ten instances are deployed. When the access increases, it can be expanded to twenty, etc.
The meaning of splitting microservices
name
Introduction
Easy to implement
Based on spring boot, the iteration is fast
Easy to maintain
It is not necessary to modify a function like a monolithic architecture, which may involve other functions, which are large and complex, and difficult to clarify
Easy to deploy
Based on springboot, generally embedded tomcat can be directly put into tomcat
Easy to update
After the split, the business is clear, the coupling is greatly reduced, and other services will not be affected
Form a closed loop
From requirements → development → integration → testing → deployment, greatly speed up
How to split microservices
name
Introduction
Horizontal split
Split by service
Vertical split
For example, the three-tier architecture is horizontal split