Article Directory
Architecture evolution
- Monolithic architecture
war
, Thejar
package contains all the functions of an application.
- Clustering and verticalization (divide and conquer)
- Increase servers horizontally, turning a single machine into a cluster of multiple machines.
- Longitudinal split for business, business to reduce the coupling, a single reduction
war
difficult package brings scalability issues.
- SOA (Service Oriented)
- The core goal is to extract some common shared services that will be called by multiple upper-layer services into independent basic services.
- The main problems to be solved:
- Information island
- Shared business reuse
- Microservice architecture
- Difference from SOA
- SOA focuses on the reusability (reuse) of services and the elimination of information islands; microservices focus on decoupling and reducing the degree of coupling between businesses.
- Micro-services more attention
DevOps
and sustained delivery on because after the micro-services enable developers to refine the operation and maintenance becomes more important, therefore, micro-technology services in conjunction with the container closer.
- advantage:
- Controllable complexity: fine-grained business splitting, small service boundaries, and low complexity.
- Flexible technology selection: Free choice of technology framework according to business characteristics.
- More scalable: Flexible expansion based on the performance requirements and business characteristics of a single microservice, such as increasing the cluster size of a single microservice, and improving the hardware configuration of a single node.
- Independent deployment: Each microservice is an independently running process, so independent deployment can be achieved, and the release is more efficient.
- Fault tolerance: When a service fails, the fault can be isolated in a single service, and other services can achieve application-level fault tolerance through mechanisms such as retry and degradation.
- challenge:
- Troubleshooting: One request may experience multiple interactions of multiple microservices, the interaction link may be long, and it is difficult to locate the root cause of the problem.
- Service monitoring: In an architecture composed of hundreds of microservices, the monitoring overhead will be very large. Not only the entire service link must be monitored, but also a single microservice must be monitored.
- Architecture complexity: The microservice itself is a distributed system that involves remote communication between services. Network delays and failures are said to be unavoidable, thereby increasing the complexity of the application.
- Service dependency: A -> B -> C, according to the dependency, it needs to be updated level by level.
- Operation and maintenance costs: rapid deployment, troubleshooting, rapid capacity expansion and other issues.
- The microservice structure is not a silver bullet , and it cannot solve all architectural problems.
- The essence of the architecture is the orderly reconstruction of the system, which makes the system evolve continuously.
- Difference from SOA
Spring Cloud mainstream implementation
The mainstream microservice solutions in the industry:
- Spring Cloud Netflix
- Eureka: Service Registration and Discovery
- Zuul: Service Gateway
- Ribbon: load balancing
- Feign: client proxy for remote services
- Hystrix: Circuit breaker, providing service fusing and current limiting functions
- Hystrix Dashboard: monitoring panel
- Turbine: Unified aggregation of Hystrix monitoring information of service instances
- Spring Cloud Alibaba
- Nacos: Service registration and discovery, distributed configuration center
- Dubbo:RPC通信
- Seate: Distributed transaction
- Sentinel: Traffic control and service degradation
- RocketMQ: Message Driven