Get the App
SLTechnology News&Howtos  ›  Servers  › 

LVS four-layer load balancing

Shulou Source: shulou.com Published: 2022-06-02 01:33:03 10月04日 Update

LVS four-layer load balancing

IP messages do not go through the forward chain

1. LVS works on the input chain of netfilter in kernel space, just like the netfilter framework, installing iptables command writing rules can work on the netfilter framework that has already been compiled into the kernel. Similarly, ipvs has already been compiled in the kernel, we just need to install ipvsadm management commands, write the rules, and it will take effect.

2. Ipvsadm: user space defines a command line tool for managing LVS

Ipvs: a framework that works on the input chain of kernel space and has been compiled into the kernel.

LVS type:

1. LVS-NAT (address translation): translates the requested destination address into the address of real server. Multi-objective DNAT.

All inbound and outbound traffic will pass through the director,real server gateway and should be directed to director.

2. LVS-DR (Direct routing): director and real server must be on the same physical network with no router in between.

Director only processes incoming requests, and the response is made directly by real server and client.

3. LVS-TUN (tunnel): similar to DR, except that the IP message is encapsulated in a layer to form a tunnel transmission.

Load balancing algorithm:

Common algorithms (default is wlc, so wlc is the most reliable):

1. Rr:round robin, polling method

2. Wrr:weight round robin, weighted polling

3. Sh:source hash, the original address of hash, is used to bind session sessions

4. Lc:least connections, based on minimum connections

5. Wlc:weight least connections, weighted least connection

6. Dh:destination hash, available when the backend is a cache server

Tags: Kernel address command framework space compilation equalization function message mode goal algorithm rule route tunnel work management similarity just tool Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno Huawei MySQL MariaDB