Introduction to LVS load balancing and clustering

The meaning of clusters

Cluster, cluster is
composed of multiple hosts, but externally only appears as a whole.
In Internet applications, as the site has higher and higher requirements for hardware performance, response speed, service stability, and data reliability, a single server Powerless
! How to solve it.
Use expensive minicomputers and mainframes.
Use ordinary servers to build service clusters
. The SLB in Alibaba Cloud is a typical load balancing scheduler. ECS is a cloud host (virtual machine). The
SLB schedules ECS. Multiple ECSs form a resource pool. Form the foundation of cloud computing

Common enterprise cluster classification

Load balancing cluster

With the goal of improving the responsiveness of the application system, processing as many access requests as possible, and reducing latency, achieving high concurrency and high load (LB) overall performance
. The load distribution of LB depends on the distribution algorithm of the master node. The distribution algorithm is scheduling.
Highly available cluster

Highly available cluster

To improve the reliability of the application system and reduce the interruption time as much as possible, to ensure the continuity of the service, and achieve the fault tolerance effect of high availability (HA).
The working mode of HA includes duplex and master-slave modes
. Collaborative work in a level state can replace each other at any time.
With a master-slave mode, one master and multiple slaves, it is called a centralized cluster
decentralization mechanism: there is no real master, if there is a symbolic meaning, all nodes All work (Redis cluster is a typical decentralized mechanism)

High-performance computing cluster

With the goal of increasing the CPU computing speed of the application system, expanding hardware resources and analysis capabilities, obtaining the equivalent of large-scale, supercomputer high-performance computing (HPC) capabilities. The
high performance of high-performance computing clusters depends on "distributed computing" and "parallel Computing", through dedicated hardware and software to integrate the CPU, memory and other resources of multiple servers to achieve computing capabilities that only large and supercomputers have

Load balancing

Load balancing structure

Insert picture description here

The first tier, the
second tier of Load Balancer (Load Balancer or Director) , the
third tier of the Server Pool , and the shared storage (Share Storage)

Working mode analysis

Load balancing cluster is currently the most commonly used cluster type in enterprises.
There are three working modes for cluster load scheduling technology

NAT mode

Address translation (Network Address Translation) is
abbreviated as NAT mode, which is similar to the private network structure of a firewall. The load scheduler serves as the gateway of all server nodes, that is, as the access entrance of the client, and each node responds to the access of the client. The
server node uses private The IP address is located on the same physical network as the load scheduler, and the security is better than the other two methods
Insert picture description here

TUN mode

IP Tunnel (IP Tunnel) is
abbreviated as TUN mode. It adopts an open network structure. The load scheduler is only used as the client's access entrance. Each node directly responds to the client through its own Internet connection, instead of being
scattered through the load scheduler server node Have independent public IP addresses in different locations on the Internet, communicate with the load scheduler through a dedicated IP tunnel
Insert picture description here

DR mode

Direct Routing is
abbreviated as DR mode, which adopts a semi-open network structure, which is similar to the structure of TUN mode, but the nodes are not scattered in various places, but are located in the same physical network as the
scheduler. The scheduler and each node The server is connected through the local network, no need to establish a dedicated IP tunnel

Overview of LVS Virtual Server

The abbreviation of Linux Virtual Server,
a load balancing solution for the Linux kernel
, was created by Dr. Wensong Zhang from China in May 1998

LVS load scheduling algorithm

Round Robin distributes
the received access requests to each node (real server) in the cluster in turn, and treats each server equally, regardless of the actual number of server connections and system load
weighted round-robin (Weighted). Round Robin)
According to the processing capacity of the real server, the received access requests are allocated in turn. The scheduler can automatically query the load status of each node and dynamically adjust its weight to
ensure that the server with strong processing capability bears more access traffic.
Least Connections )
Distribution is based on the number of connections established by the real server, and the received access request is preferentially distributed to the node with the
least number of connections. Weighted Least Connections
can be the real server when the performance of server nodes differs greatly. Automatically adjust weights
Nodes with higher weights will bear a greater proportion of active connection load

Guess you like

Origin blog.csdn.net/Ora_G/article/details/108321058