First, we will introduce the LVS cluster.
LVS cluster Composition
Front-end: Load Balancing Layer
-Composed of one or more load schedulers
Intermediate: server group Layer
-A group of servers that actually run the Application Service
Bottom: data shared storage layer
-Provides a storage area for a shared bucket.
LVS terminology
Director server: Scheduling server that distributes loads to Real Server servers.
Real Server: A Real Server that truly provides application services
VIP: virtual IP address, which is published to the user.
Rip: The real IP Address used on the cluster node.
Dip: IP address of realctor connected to RealServer
LVS Load Balancing
NAT: virtual server implemented by Network Address Translation
-Director changes the destination address of the user request message to the selected Real Server address and forwards it to the real server.
-The performance of the scheduler becomes a bottleneck during high-concurrency access
DR: directly use routing technology to implement virtual servers
-Rewrite the MAC address of the request message to send the request to the Real Server. The RealServer directly responds to the client.
Tun: Implements virtual servers through Tunneling
-After Director uses tunneling technology to send requests to the Real Server, the real server directly responds to the client.
Load Balancing Scheduling Algorithm
LVS currently implements 10 Scheduling Algorithms
There are four common Scheduling Algorithms
-Round Robin)
-Weighted Round Robin (Weighted Round Robin)
-Least connections (least connections)
-Weighted least connections)
Round Robin)
-Evenly distribute client requests to Real Server
Weighted Round Robin (Weighted Round Robin)
-Set weights based on the real server performance and then perform round-robin scheduling.
-Least connections (least connections)
-Dynamically schedule network requests to servers with the least number of established connections
-Weighted least connections)
-Set the weight based on the performance of the real server, and then schedule the network request to the server with the least established connections
Locality-based least connections)
-Find the Server recently used by the target IP address of the request. If the server is available and is not overloaded, send the request to the server. If the server does not exist, alternatively, if the server is overloaded and has half of the server's workload, use the "least link" principle to select an available server and send the request to the server.
Locality-based least connections withreplication)
-Maintain the ing from a target IP address to a server
-Find the server group corresponding to the target IP address of the request, and select a server from the server group based on the "minimum connection" principle. If the server is not overloaded, send the request to the server; if the server is overloaded, select a server from the cluster based on the "minimum connection" principle, add the server to the server group, and send the request to the server.
-When the server group has not been modified for a period of time, delete the busiest server from the server group to reduce the degree of replication.
Destination hashing)
-Find the corresponding server from the static allocation hash list based on the target IP address of the request as the hash key. If the server is available and not overloaded, send the request to the server; otherwise, null is returned.
Source hashing)
-Find the corresponding server from the static allocated hash list based on the requested source IP address as the hash key. If the server is available and not overloaded, send the request to the server; otherwise, null is returned.
Shortest expected delay scheduling SED)
-Wlc-based algorithm
-Weights of machines A, B, and C are 1, 2, and 3 respectively, and connections are also 1, 2, and 3. If the wlc algorithm is used, a new request may be allocated to any one of the ABC
-The SED algorithm performs the following operations: A (1 + 1)/1, B (1 + 2)/2, C (1 + 3)/3
-Submit the connection to C based on the calculation result.
Never queue scheduling NQ)
-If the number of connections to a real server is 0, it will be allocated directly, without the SED operation.
This article from the "Linux cainiao" blog, please be sure to keep this source http://ludihua.blog.51cto.com/4601284/1530995