【SpringCloud】01 Architecture evolution history

1. History of architecture evolution

Single application architecture---->Vertical application architecture---->Distributed architecture----->SOA architecture----->Microservice architecture

1. Monolithic application architecture

Write all functions in one project. This architecture is a monolithic architecture.
advantage:

项目架构简单,小型项目的话,开发成本低。
项目部署在一个节点上,维护方便. 项目部署比较简单

shortcoming:

全部功能集成在一个工程中,对于大型项目来讲不易开发和维护[修改代码]。
项目模块之间紧密耦合,单点容错率低。
无法针对不同模块进行针对性优化和水平扩展

2. Vertical application architecture

As the number of visits gradually increases, a single application can only rely on adding nodes to cope with it. However, at this time, you will find that not all modules will have a relatively large number of visits.


Taking the above e-commerce example as an example, the increase in user visits may only affect the users and order modules, but the impact on the message module will be relatively small. So at this time we hope to only

add a few more order modules without adding messages. Module. At this time, a single application cannot be achieved, and vertical applications emerge as the times require.


The so-called vertical application architecture is to split the original application into several unrelated applications to improve efficiency. For example, we can split the above single e-commerce application into:


E-commerce system (user management, product management, order management)


Backend system (user management, order management, customer management)


After the CMS system (advertising management and marketing management)



is split in this way, once the number of user visits increases, it is only necessary to add nodes to the e-commerce system, without adding nodes to the backend and CMS. Create three projects.
Insert image description here
advantage:

系统拆分实现了流量分担,解决了并发问题,可以针对不同模块进行优化和水平扩展 
一个系统的问题不会影响到其他系统,提高容错率

shortcoming:

系统之间相互独立, 无法进行相互调用
系统之间相互独立, 会有重复的开发任务.

3. Distributed architecture

As there are more and more vertical applications, there will be more and more duplicate business codes. At this time, we thought about whether we could extract the duplicate code and make it into a unified business layer as an independent service (service), and then the front-end control layer (controller) calls different business layer services?

This gives rise to new distributed system architectures. It will split the project into two parts: the presentation layer controller and the service layer service. The service layer contains business logic. The presentation layer only needs to handle the interaction with the page, and the business logic is implemented by calling the services of the service layer.
Insert image description here
advantage:

抽取公共的功能为服务层,提高代码复用性

shortcoming:

调用关系错综复杂,难以维护

4. SOA architecture-dubbo[Alibaba-stopped in 2015]

In a distributed architecture, when there are more and more services, problems such as capacity evaluation and waste of small service resources gradually emerge. At this time, it is necessary to add adispatch centerManage the cluster in real time. At this time, the resource scheduling and management center (SOA
Service Oriented Architecture, service-oriented architecture) is the key.
Insert image description here
advantage:

使用注册中心解决了服务间调用关系的自动调节 

shortcoming:

服务间会有依赖关系,一旦某个环节出错会影响较大( 服务雪崩 ) 
服务关系复杂,运维、测试部署困难。

5. Microservice architecture

To some extent, microservice architecture is the next step in the continued development of service-oriented architecture SOA. It places more emphasis on the "complete split" of services - and each service can run independently ----> springboot (independent system) must rely on springboot technology. If Springcloud does not have springboot, springcloud cannot be used. springboot can be used independently. Because tomcat is built into springboot and runs independently. Java -jar xxx.jar
Insert image description here
advantages:


l Services are atomically split, packaged, deployed and upgraded independently to ensure clear task division for each microservice, which facilitates expansion


l Microservices use lightweight http protocols such as Restful to call each other.


Disadvantages: Small projects-microservice architecture is not suitable. Warehouse system—microservices.


l The technical cost of microservice system development is high (fault tolerance, distributed transactions, etc.)

2. Problems faced by microservices

l With so many small services, how to manage them?

l With so many small services, how do they communicate with each other?

l With so many small services, how does the client access them?

l With so many small services, once a problem occurs, how should you handle it yourself?

l With so many small services, once a problem occurs, how should we troubleshoot it?

Provide corresponding components to solve the above problems

nacos registration center to manage these microservices

openfeign to complete the calls between services.

gateway gateway – solves customer access to microservices. ,

Fuse----solve service self-processing capability

Link tracking—Trace the microservices where the corresponding error is found.

Commonly used microservice frameworks

ServiceComb

Apache ServiceComb, formerly Huawei Cloud's microservice engine CSE (Cloud Service Engine) cloud service, is the world's first top-level Apache microservices project. It provides a one-stop microservice open source solution and is committed to helping enterprises, users and developers easily migrate enterprise applications to microservices on the cloud, and achieve efficient operation and maintenance management of microservice applications.

SpringCloud

Many of the components it provides have been discontinued.

Spring Cloud is a collection of frameworks. It uses the development convenience of Spring Boot to cleverly simplify the development of distributed system infrastructure, such as service discovery registration, configuration center, message bus, load balancing, circuit breakers, data monitoring, etc., all of which can be done using the Spring Boot development style. to one-click startup and deployment.
Spring Cloud does not reinvent the wheel. It just combines the relatively mature and practical service frameworks developed by various companies, and re-encapsulates them through Spring Boot style to shield the complex configuration and implementation principles, and finally provides Developers have set out a distributed system development toolkit that is easy to understand, deploy, and maintain.

springcloud-alibaba microservice architecture

Most of the components it uses are used by Alibaba. If Alibaba does not provide it, Spring will create the corresponding components and use its own.

Guess you like

Origin blog.csdn.net/qq_60969145/article/details/127969304