Single – machine, distributed, cluster difference and connection
I. Single machine structure
When the business volume of a system is low, all the code is placed in a project, and then the project is deployed on a server that provides all the services for the whole project. This is the single-machine architecture. The disadvantages of single machine architecture are obvious. The processing capacity of single machine is limited after all. When your business grows to a certain extent, the hardware resources of single machine will not be able to meet your business needs. This is where the cluster pattern emerges.
Second, cluster structure
When the single-machine processing reaches a bottleneck, you make several copies of the single-machine, thus forming a “cluster”. Each server in the cluster is called a “node” of the cluster, and all the nodes make up a cluster. With each node providing the same service, the processing power of the system is multiplied by several times.
But the question is which node will handle the user’s request? It is best to let nodes that are less loaded at the moment handle the load so that the pressure on each node is equal. To do this, a “scheduler” role is added in front of all the nodes. All requests from the user are sent to it first, and it then decides which node to process the request based on the current load of all nodes. This “scheduler” has an awesome name – load balancing server.
The advantage of the cluster structure is that it is very easy to scale the system. If your current system becomes unsustainable as your system business grows, add additional nodes to the cluster. However, as your business grows to a certain point, you may find that no matter how many nodes you add, the overall cluster performance does not improve significantly. This is where you need to use a microservice architecture.
Third, distributed structure
From a single machine structure to a cluster structure, your code doesn’t need to change at all. You just need to deploy several servers, each running the same code. However, as you move from a cluster structure to a microservice structure, the previous set of code needs to change significantly. Therefore, for the new system, we suggest that the micro-service architecture should be adopted at the beginning of system design, so that the later operation and maintenance cost will be lower. But if an older system needs to be upgraded to a microservice architecture, it will require major code changes. So, for the old system, whether to stay clustered or upgrade to a microservices architecture will require your architect to carefully weigh the input-output ratio.
Let’s start with what’s 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 a Web container and communicate with each other via RPC.
As an example, suppose you need to develop an online mall. According to the idea of micro-service, we need to divide into multiple 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 of these services is a separate project and can be run independently. If there are dependencies between services, they are called through RPC.
The benefits are many:
1, the coupling degree between the systems is greatly reduced, independent development, independent deployment, independent testing, the boundary between the system and the system is very clear, troubleshooting has become quite easy, the development efficiency is greatly improved.
2, the coupling degree between the systems is reduced, so that the system is easier to expand. We can extend certain services specifically. Assuming that this mall is going to carry out a big promotion, the order volume may be greatly increased, so we can improve the number of nodes in the order system and product system, and for the background management system and data analysis system, the number of nodes can be maintained at the original level.
3. Higher service reusability. 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.
Four, the difference and connection between the three
The following cartoon vividly illustrates the differences and connections among the three:
Five, the summary
Clustering is a physical form, and distribution is a way of working. As long as it is a bunch of machines, it can be called a cluster. No one knows whether they work together or not. A program or system that runs on different machines can be called distributed, and a C/S architecture can also be called distributed.
Clusters are generally physically centralized and centrally managed, whereas distributed systems do not emphasize this. So the cluster may be running one or more distributed systems, or it may not be running a distributed system at all; Distributed systems may run on a cluster or on multiple machines (two counts as many) that are not part of a cluster.
※ Some articles from the network, if any infringement, please contact to delete; More articles and materials | click behind the text to the left left left 100 gpython self-study data package Ali cloud K8s practical manual guide] [ali cloud CDN row pit CDN ECS Hadoop large data of actual combat operations guide the conversation practice manual manual Knative cloud native application development guide OSS Operation and maintenance actual combat manual cloud native architecture white paper Zabbix enterprise distributed monitoring system source document 10G large factory interview questions