What is the difference between distributed and clustered?

one.

Distributed: A business is split into multiple sub-businesses and deployed on different servers
Clustering : The same business is deployed on multiple servers

two.

The small restaurant used to have only one chef, who cut and washed vegetables, prepared and cooked all the vegetables. Later, there were too many guests, and a chef in the kitchen was too busy, so another chef was hired. Both chefs could cook the same dishes. The relationship between the two chefs was a cluster. In order to let the chef concentrate on cooking and make the dishes to the extreme, we hired a side chef to be responsible for cutting, preparing, and preparing the vegetables. The relationship between the chef and the side chef is distributed, and even a side chef is too busy. I hired a chef, and the relationship between the two chefs is a cluster

three.

write picture description here

Click Structure

concept

The stand-alone structure I think everyone is most familiar with is the stand-alone structure. When the business volume of a system is small, all the code can be placed in a project, and then the project can be deployed on a server. All services for the entire project are provided by this server. This is the stand-alone structure.

shortcoming

So, what are the disadvantages of the stand-alone structure? I think the disadvantage is obvious. After all, the processing capacity of a single machine is limited. When your business grows to a certain extent, the hardware resources of a single machine will not be able to meet your business needs.

Cluster structure

Cluster structure Cluster mode has various explanations in the world of programmers, some of which make you unable to understand at all. In fact, it is a very simple thing, let me tell you one by one. When the single-machine processing reaches the bottleneck, you copy several copies of the single-machine, thus forming a "cluster".
Each server in the cluster is called a "node" of the cluster, and all nodes constitute a cluster.
Each node provides the same service, so the processing power of the system is equivalent to several times higher (a few nodes is equivalent to so many times higher).
But the question is which node handles the user's request? It is best to let the node with less load at this moment handle it, so that the pressure on each node is more even. To achieve this function, it is necessary to add a "scheduler" role before all nodes. All requests of users are given to it first, and then it decides which node to send the request to according to the current load of all nodes. This "scheduler" has a cool name - a load balancing server. The advantage of the cluster structure is that it is very easy to expand the system. If the current system can no longer support the development of your system business, then you can add more nodes to the cluster. However, when your business develops to a certain level, you will find a problem - no matter how you add nodes, it seems that the performance improvement effect of the entire cluster is not obvious.

distributed

At this point, you need to use the microservice structure. The distributed structure first summarizes the previous knowledge points. From the stand-alone structure to the cluster structure, your code basically does not need to be modified. All you need to do is deploy a few more servers and run the same code on each server. However, when you want to evolve from a cluster structure to a microservice structure, the previous set of code needs to undergo major changes. Therefore, for the new system, we recommend that the microservice architecture 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 take a lot of work on the code. Therefore, for the old system, whether to continue to maintain the cluster mode or upgrade to a microservice architecture requires your architects to carefully consider and weigh the input-output ratio. OK, let's start with the so-called distributed structure. The distributed structure is to split a complete system into independent subsystems according to business functions. In the distributed structure, each subsystem is called a "service". These subsystems can run independently in the web container, and communicate with each other through RPC. For example, suppose you need to develop an online store. According to the idea of ​​microservices, we need to split into multiple independent services according to functional modules, such as: user services, product services, order services, background management services, data analysis services, and so on. Each of these services are independent projects that can run independently. If there is a dependency between services, call it by RPC. There are many advantages of this: the coupling between systems is greatly reduced, independent development, independent deployment, and independent testing are possible, the boundaries between systems are very clear, troubleshooting becomes quite easy, and development efficiency is greatly improved. Coupling between systems is reduced, making the system easier to expand. We can expand certain services in a targeted manner. Assuming that this mall is going to hold a big promotion, the number of orders may be greatly increased. Therefore, we can increase the number of nodes in the order system and product system in a targeted manner. For the background management system and data analysis system, the number of nodes remains the original. level. Services are more reusable. For example, when we use the user system as a separate service, all products of the company can use the system as a user system, without repeated development

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324664986&siteId=291194637