Technical dry goods: single, SOA, microservices, distributed, detailed cluster architecture

Monolithic architecture

What is a monolithic architecture

An archive package (such as war format or Jar format) contains an application with all the functions of the application, and we usually call it a monolithic application. The methodology of architecture monolithic applications is called monolithic application architecture, which is a more traditional architectural style. .

Monolithic architecture example diagram

The defects of the monolithic architecture

1. High complexity The
entire project contains a lot of modules, the boundaries of the modules are blurred, the dependencies are not clear, the code quality is uneven, and the entire project is very complex. Every time I modify the code, I am frightened, even adding a simple function or modifying a BUG will cause hidden defects.

2. Technical debt gradually rises.
With the passage of time, demand changes and personnel turnover, the technical debt of the application will gradually form, and it will accumulate. The used system design or code is difficult to modify because other modules of the application may use it in unexpected ways.

3. The deployment speed gradually slows down.
As the code increases, the time to build and deploy will also increase. In a monolithic application, every function change or defect repair will cause us to redeploy the entire application. The full deployment method takes a long time, has a large scope of influence, and has high risks. This makes the frequency of online deployment of a single application project lower, which in turn leads to a large number of function changes and defect repairs between two releases, and a high probability of error.

4. The scalability is limited and cannot
be scaled as needed. A single application can only be scaled as a whole, and cannot be scaled with the characteristics of business modules.

5. Blocking technological innovation
Monolithic applications often use a unified technology platform or solution to solve all problems. Each member of the team must use the same development language and architecture. It is very difficult to introduce a new framework or technology platform.

As the shortcomings of the monolithic architecture are becoming more and more obvious, more and more companies are adopting the microservice architecture to solve the problems in the monolithic architecture mentioned above.

Different from building a single, huge application, the microservice architecture splits the application into a set of small and interconnected services.

SOA architecture

SOA is the abbreviation of Service-Oriented Architecture, which is a service-oriented architecture. The service here can be understood as a service layer business service.
Single application architecture
When the website traffic is very small, only one application is needed and all functions are deployed together to reduce deployment nodes and costs.
Vertical application architecture
When the number of visits gradually increases, the acceleration caused by the addition of a single application to the machine becomes smaller and smaller, and the application is divided into several unrelated applications to improve efficiency.
Distributed service architecture
When there are more and more vertical applications, interaction between applications is inevitable. The core business is extracted as an independent service, and a stable service center is gradually formed, so that front-end applications can respond more quickly to changing market demands .
Mobile computing architecture
When there are more and more services, the evaluation of capacity and the waste of small service resources gradually appear. At this time, a dispatch center needs to be added to manage the cluster capacity in real time based on access pressure to improve cluster utilization.
At this time, SOA service governance solutions for improving machine utilization are the key.
Dubbo is the core framework of SOA service governance program.
Summary: Dubbo can not only manage services, but also call services.

Microservice architecture

What is microservice architecture

In short, the development method of the microservice architecture style is to develop an independent application system by developing a set of small services. Each of these small services runs in its own process and often uses the lightweight mechanism of HTTP resource API to communicate with each other.

These services are built around business functions and can be deployed independently through a fully automated deployment mechanism. These microservices can be written in different languages ​​and can use different data storage technologies. We only do minimal centralized management of these microservices.

Sample microservice architecture diagram

Features of microservice architecture

Each microservice can run independently in its own process.
A series of independent microservices jointly build the entire system.
Each service is an independent business development. A microservice only focuses on a specific function, such as order management and user management. other
between the micro services through some lightweight communication mechanisms, such as REST API interface call
may use different languages and storage technology
deployment mechanism fully automated

Advantages of microservice architecture

1. Easy to develop and maintain
A microservice only focuses on a specific business function, so its business is clear and the amount of code is small. It is relatively simple to develop and maintain a single microservice. The entire application is constructed from several microservices, so the entire application will remain in a controllable state;

2. A single microservice starts faster. A
single microservice has less code, so the startup will be faster;

3. Partial modification is easy to deploy.
As long as a single application is modified, the entire application must be redeployed. Microservices solves this problem. Generally speaking, to modify a microservice, you only need to redeploy the service;

4. Unrestricted technology stack.
In microservices, we can select the technology stack reasonably based on the characteristics of the project business and team

5. Scale on demand

Challenges of microservice architecture

1. Higher operation and maintenance requirements
More services mean more operation and maintenance investment. In a monolithic architecture, only the normal operation of one application needs to be guaranteed; while in microservices, it is necessary to ensure the normal operation and collaboration of dozens or even hundreds of services, which brings huge challenges;

2. The inherent complexity of distributed The
use of microservices to build a distributed system. For a distributed system, system fault tolerance, network latency, distributed transactions, etc. all bring huge challenges;

3. The cost of interface adjustment is high.
Microservices communicate through interfaces. If you modify the API of a microservice, all microservices that use the interface may need to be adjusted;

4. Duplicate work
Many services may use the same functions. And this function has not reached the level of decomposition into a microservice. At this time, each service may develop this function, resulting in code duplication.

Microservice design principles

Single responsibility principle
Service autonomy principle
Lightweight communication principle
Clear interface principle

The difference between microservices and SOA

The first focus of the microservice architecture is that the business system needs to be completely componentized and service-oriented. The
microservices no longer emphasize the ESB enterprise service bus, which is heavier in the traditional SOA architecture. At the same time, the SOA idea enters a single business system to achieve real Componentization.

Distributed-microservice-cluster difference

distributed

Service A, B, C, and D are business components, respectively, which are accessed through API Geteway.

A large system is divided into multiple business modules, and the business modules are deployed on different machines , and each business module exchanges data through interfaces.

The way to distinguish distributed is based on different machines and different businesses.

Note: Distributed requires good transaction management.

Cluster mode

In the cluster mode, different servers deploy the same set of services for external access to achieve load balancing of services.

The way to distinguish clusters is based on whether the services of multiple servers are the same.

Note: The cluster mode needs to do a good job of session sharing to ensure that during the process of switching between different servers, the service will not be terminated because the session is not obtained.

Generally configure Nginx*'s load container implementation: static resource caching and Session sharing can be implemented with it, and Nginx supports 5000 concurrency.

Is distributed a microservice?

The answer is yes. Microservice means that the module is split into an independent service unit to realize data interaction through interfaces.

Microservice architecture

The design of microservices is not to affect the existing system business due to the upgrade and BUG of a certain module.

The subtle difference between microservices and distributed is that the application of microservices is not necessarily scattered on multiple servers, it can also be the same server.

The architecture of distributed and microservices is very similar, but the deployment method is different.

If you think this article is helpful to you, you can like it and follow it to support it, or you can click on my homepage to follow my public account. There are more technical dry goods articles and related information sharing on it, everyone learns and progresses together!

 

 

Guess you like

Origin blog.csdn.net/weixin_50205273/article/details/109169400