LVS（Linux Virtual Server）-Different Methods of Loading Balance
With the increasing growth of internet users,the volume of traffic that the web based companies deal with has increased dramatically.These are differetn solutions to cope up with this increasing traffic.One solution is to scale your servers vertically(ie:simply add more CPU and Memory Resources to your server),which of course cannot be done after a certain extent.
Anther solution is to scale the server horizontally(ie:Add more servers that can deal with the surge in traffic.This mechanism is generally known as clusters.In a cluster,multiple servers act together as a single component providing the required services to end users.
Let's consider an example request from a client to the virtual server and the final response that goes back to the client frma the load balancer.Blow are the addresss that we will be useing to understanding this example.
Client Source Address:10.69.24.223
Virtual IP(IP that is assaigned to Load Balancer):184.108.40.206
Step 1:User(10.69.24.223) sends a request for the required service to VIP assaigned to the Load Balancer(220.127.116.11)
Step 2: On receiving the requests,the load balancer,checks the reuqest destinatinaion and the port.If the request matches a particular service defined in the load balance configuration, a real server from the pool(in this example,we have two servers) is selected with the help of the selection algorithm.Once the Real Server is selected, the Load Balance notes down the connection information and the selected real server into a table and then modifies the package's destination address and port(to that of the real server),and forwards the package to the real server.
Step 3:When the Load balance gets the response packets from the real server,it again rewrites the source address and port to that of it own Virtual IP and service port.It then sends that response back to the user