What is a server cluster? Simply put, a server cluster is a computing mode composed of multiple computers on a specific computing topic, which has the characteristics of collaborative division of labor and appears as a whole to the outside world. With the development of technology, the role of server clusters has gradually become prominent.
What is a server cluster?
In a cluster system, all computers have a common name, and all network clients can use services running on any system in the cluster. The cluster must be able to coordinate and manage errors and failures of separate components, and be able to transparently add components to the cluster. The user's public data is placed in a shared disk cabinet, and the application is installed on all servers, that is, the application running on the cluster needs to be installed once on all servers.
Generally speaking, the common purpose of clusters is to reduce the computing pressure of a single server and improve the overall computing power. In a cluster, each computer has a professional name: node. For clusters, its advantages and disadvantages are also obvious. In theory, there is no upper limit on business processing capacity, which can significantly improve business processing efficiency and achieve uninterrupted business. However, it also requires high construction and maintenance costs. For clusters, it is also very simple to increase computing power by directly adding nodes. For clusters, it is very easy to expand nodes without stopping. What's more interesting is that the cluster has very loose requirements on node performance, so we can add computers with better performance as new nodes. For clusters, nodes can be completely changed without stopping.
Load balancing cluster: Load balancing cluster is the most common and widely used type of server cluster. Its purpose is to share the overall pressure of the service. It works by distributing requests from different sources to different nodes for processing according to specific rules. Load balancing clusters can be divided into two types: software type and hardware type. There are three main types of software load balancing: 1. LVS; 2. NGINX; 3. HAPROXY. Hardware type is generally less contacted. In the software model, LVS and NGINX are more commonly used. LVS has been integrated into the Linux kernel.
Load balancing cluster structure: The working mode of the load balancing cluster is that the client's request is only sent to the scheduler node. After receiving the request, the scheduler node will forward the request to the service processing node for service processing according to the established rules. Although the scheduler node does not participate in the actual business processing, its communication pressure is also very large.
What is a server cluster
Scheduler: The core part of the scheduler is the scheduling algorithm. Scheduling algorithms can be divided into static algorithms and dynamic algorithms. Static algorithms are a mode of request distribution strictly in accordance with algorithm rules, while dynamic algorithms will investigate the load of each node in the current cluster before distribution, and comprehensively consider the resource occupancy of the current node and the algorithm itself, and then decide which node to entrust the client's request to. Obviously, the performance of the dynamic algorithm will be better, but it will also occupy a little more resources.
The polling algorithm and the minimum connection algorithm are the simplest and most mechanical algorithms. The former distributes requests to nodes in sequence, and the latter is similar. The difference is that the node with the least current number of connections will be assigned to the person with the least pressure, that is, the person with the least pressure will be assigned to the task.
Based on polling and minimum connection, an improved algorithm, namely the weighted algorithm, is proposed. The so-called weighting is to set a "score" for each node, which is usually evaluated based on the performance of the node. Since different nodes may have different computing capabilities, in order to better share the computing load and make more reasonable use of cluster resources, more computing tasks should be assigned to nodes with strong computing capabilities, which is the so-called "who can do more work".
Source address hashing distributes all requests from the same source to the same node for processing. This algorithm is suitable for scenarios where login credentials need to be verified. Target address hashing is to send all requests to access the same resource on the server to the same node. This algorithm is suitable for scenarios where business processing nodes need to fetch data from other places. In this case, applying this algorithm can improve cache hit rate and save server pressure.
High-performance scientific computing cluster: This kind of cluster is far away from ordinary people. Generally, it is a strategic computing resource controlled by the state, and ordinary people are inaccessible and unreachable clusters. There is still a lot of knowledge about server clusters, but the author studies it just to broaden his horizons, basically blindly, and almost the same.
High-availability cluster: The purpose of a high-availability cluster is to keep the service uninterrupted, that is, the server will not shut down. However, in fact, no one can guarantee that a computer will never shut down. Therefore, in order to ensure that the service is not interrupted, we can only recover in the shortest time after the service is interrupted. So the principle of high availability is relatively simple, that is, to adopt a dual-machine hot standby mode. In the server that needs to provide services, open two nodes with the same business data, preferably nodes with the same hardware configuration. One is set as the master, that is, it currently provides services to the outside world, and the other is set as the slave, which does not provide any services to the outside world. The only task of the slave is to synchronize the business data on the host and monitor the status of the host. When the host service is interrupted, it immediately takes over the service rights, sets itself as the host, and then continues to provide services to the outside world. Since the business data in the slave is almost the same as that in the host, this behavior of the switching machine will not have much impact on customer service.
What types of server cluster technology are there?
1. Peer-to-peer cluster
Each node has the same weight and function and can handle requests equally.
2. Master-slave cluster
One node is the master node, responsible for processing requests and data updates, and other nodes are slave nodes, which are only responsible for data backup and reading.
3. Distributed cluster
Different nodes are scattered in different places, and communication and data sharing are carried out through network connections.
4. Multi-layer cluster
Divide different nodes according to functions and levels, each node is only responsible for specific tasks, and completes the work of the entire system through collaboration.
5. Virtualization cluster
Use virtualization technology to virtualize multiple physical servers into one logical server to improve resource utilization and flexibility.
What is a server cluster? You will know it clearly after reading the article. Server cluster refers to the collection of many servers to perform the same service together, using multiple computers for parallel computing to obtain a higher computing speed, which can better improve efficiency for enterprises.