Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What's the difference between clustering and distributed?

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what's the difference between cluster and distribution". In daily operation, I believe many people have doubts about the difference between cluster and distribution. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the question of "what's the difference between cluster and distribution"! Next, please follow the editor to study!

Clustering and distribution are both described as a group of computers. All nodes in the cluster run the same task, while nodes in the distributed system run the decomposed task.

Stand-alone structure

I think what you are most familiar with is the stand-alone structure. When the business volume of a system is very small, all the code is put in one project, and then the project is deployed on a server. All the services for the whole project are provided by this server. This is the stand-alone structure.

So, what are the disadvantages of the stand-alone structure? I think the disadvantage is obvious, the processing capacity of the stand-alone is limited after all, when your business grows to a certain extent, the hardware resources of the stand-alone will not be able to meet your business needs. At this point, the cluster mode appears, and move on.

Cluster structure

There are all kinds of pretending explanations in the programming ape world, some of which you can't understand at all, but it's actually a very simple thing, so listen to me one by one.

When the stand-alone processing reaches the bottleneck, you copy several copies of the stand-alone, which forms a "cluster". Each server in the cluster is called a "node" of the cluster, and all nodes form a cluster. Each node provides the same service, so the processing power of the system is increased several times (several nodes are equivalent to so many times).

But the question is, which node will handle the user's request? It is best to let the nodes with less load at this moment deal with it, so that the pressure on each node is more uniform. To achieve this function, we need to add a role of "scheduler" in front of all nodes, all user requests are handed over to it first, and then it decides which node to process the request according to the current load of all nodes. This "dispatcher" has a powerful name-load balancing server.

The advantage of the cluster structure is that the system is easy to expand. If with the development of your system business, the current system can not support, then add more nodes to the cluster. However, when your business develops to a certain extent, you will find a problem-no matter how many nodes are added, it seems that the improvement in the performance of the whole cluster is not obvious. At this point, you need to use the micro-service structure.

Distributed structure

Let's first make a summary of the previous knowledge points.

From the stand-alone structure to the cluster structure, your code basically does not need to be modified. All you have to do is deploy a few more servers and run the same code on each server. However, when you evolve from a cluster structure to a micro-service structure, the previous set of code needs to be changed a lot. Therefore, for the new system, we suggest that the micro-service architecture should be used 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 micro-service structure, it's going to be a big fight with the code. So, for the old system, whether to maintain the cluster mode or upgrade to the micro-service architecture requires your architect to think carefully and weigh the input-output ratio.

OK, let's start with the so-called distributed architecture.

Distributed structure is to divide a complete system into independent subsystems according to business functions. In distributed structure, each subsystem is called "service". These subsystems can run independently in web containers and communicate with each other through RPC.

For example, suppose you need to develop an online mall. According to the idea of micro-service, we need to divide 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. These services are independent projects that can be run independently. If there is a dependency between services, it is invoked through RPC.

There are many benefits:

The coupling between the systems is greatly reduced, and it can be developed, deployed and tested independently. The boundary between the system and the system is very clear, troubleshooting has become quite easy, and the development efficiency has been greatly improved. The coupling between systems is reduced, so the system is easier to expand. We can expand some services pertinently. If this mall wants to make a big promotion, the number of orders may be greatly increased, so we can pertinently increase the number of nodes in the order system and product system, while for the background management system and data analysis system, the number of nodes can be maintained at the original level. Services are more reusable. For example, when we use the user system as a separate service, all of the company's products can use the system as a user system without repeated development.

At this point, the study on "what's the difference between clustering and distribution" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report