Learn a little about service architecture: stand alone, cluster, distributed



The stand-alone architecture is easy to understand. For example, you need to deploy a set of CRM projects. The services included in this project include: Web sites for application operations, FTP services for storing files, and Oracle database services, all deployed on one server. In general, all services around this project are deployed on one server, which is a stand-alone architecture.

Structure reference drawing:



The hardware resources of stand-alone architecture are limited, which is difficult to apply to the situation of large business volume, so cluster architecture can be implemented on this basis. For example, with the increase of business volume, the processing capacity of web applications deployed on IIS decreases. At this time, multiple new server devices can be prepared and web applications can be deployed on new servers respectively. This mode constitutes a “cluster”. If a cluster is formed, each server in the cluster is equivalent to a “node” in the cluster, and each node must ensure that it provides the same service.

The problem caused by building a cluster is that users send requests to the server through client operation, so which server in the cluster will be used to process the requests? And what is the basis of choice? Then, based on this problem of cluster, a “dispatcher” load balancing server is born. As the name suggests, through the scheduling of load balancing server, a server with smaller load will be selected in the cluster to process the user’s request.

The advantage of cluster architecture is that we don’t need to change any project code. We only need to add new servers, deploy the same application and configure load balancing, which can well reduce the system pressure with the increase of business, and can directly adjust on the stand-alone architecture.

Structure reference drawing:



This figure implements a cluster for web application server on the stand-alone architecture, and schedules and processes requests through load balancing, and separates other services around the project to a single server, which greatly reduces the pressure on the server compared with the stand-alone architecture.


In my opinion, the starting point of cluster architecture is to add hardware devices for expansion, while distributed architecture is to take the business functions of application system as the starting point, and split each business function into a completely independent subsystem, which is called “service” by professional name. Multiple subsystems carry them through a main container, and each subsystem communicates directly by RPC.

For example, suppose you need to develop an online mall. According to the idea of micro service, we need to split it into several independent services according to the functional modules, such as user service, product service, order service, background management service, data analysis service and so on. Each service is an independent project, which can run independently. If there is a dependency between services, it is called through RPC.

Structure reference drawing:

As mentioned earlier, it’s very convenient for the stand-alone architecture to cluster and the cluster to expand. The code basically doesn’t need to be modified. All you have to do is to deploy more servers, run the same code on each server, and configure the load balancing. But when the cluster structure evolves to the microservice structure, the previous set of code needs to be changed greatly. Therefore, for the new system, we suggest that the micro service architecture should be adopted at the beginning of the system design, so that the cost of later operation and maintenance is lower. But if an old system needs to be upgraded to a microservice structure, it will have to fight against the code. Therefore, for the old system, whether to continue to maintain the cluster mode or upgrade to the micro service architecture needs your architects to consider carefully and weigh the input-output ratio.


I think distributed architecture will be the mainstream architecture. In addition, the most common and popular application scenario of distributed architecture is micro service architecture. Through the distributed architecture, each core function of the project can be modularized to reduce the coupling degree. Each core function of the project can be developed by a professional supplier, or by different teams of the company. In general, professionals do professional things, and each unit can independently carry out, deploy, and test, which has great advantages and efficiency in the progress and division of labor. Moreover, the distributed architecture has good reusability and portability, such as developing an order service or permission service, which can be used by other projects without repeating.


Life scene analogy

Through the architecture concepts of stand-alone, cluster and distributed, we can better understand the concepts through the analogy of scenarios in our life. The description is as follows:

When you started from scratch, you opened a Sichuan restaurant near Alibaba. Because it was just starting and the customer flow was not very large, you only hired a staff member in the kitchen. The staff member was not only responsible for cooking, but also for all kinds of work in the kitchen, such as garnishing and cutting. At this time, the scene is actually equivalent to the stand-alone architecture in our server architecture.

After the third month of the store’s opening, your business is getting better. At this time, you plan to hire several kitchen workers to work, but the work of the kitchen workers is still comprehensive, and they are also responsible for all kinds of work in the kitchen, such as garnishing and cutting, but the number of people has increased. The scene at this time is actually similar to the cluster architecture in our server architecture.

One year after opening the store, you have a good reputation and repeat customers. You plan to expand your business and take on some banquets. At this time, not only the workload increases, but also the types of work are diversified. In order to make the restaurant operate in an orderly way, you divide the responsibilities of the kitchen and open up different positions. At this time, there are special cooks, special cutting desks and special cleaning personnel. The scene at this time is actually equivalent to the distributed architecture in our server architecture, with all employees working separately Self help is responsible for their own work around the same business.