Load balancer is a device that distributes network or application traffic across a number of servers. This improves application capacity and reliability.
Load balancer decreases burden on servers, thereby improving the overall performance of application. Before looking into how load balancer works, we will
meet some terminologies that might be useful. And for this, we will consider f5 load balancer.
Node – Represent physical or virtualized servers where the service or application runs. For eg: a web server
Pool – Is a collection of nodes. Pool constantly monitor the nodes for their availability and if any node found unreachable, it mark that node as unavailable. For eg: Collection of 2 or more web servers
Virtual Server – Each virtual server has an associated pool with a protocol defined. Each virtual server will have different IP’s linked to them. These IP’s are called as VIP. For eg: WS_Http and WS_Https may be two virtual servers linking to the same pool with 2 different protocols and IP’s defined.
Health Monitor – Monitor health and performance of nodes that are members of a pool. It verifies connections on pool members and nodes and are configured in a pool. For eg: HTTP health monitor, for HTTP health verification of a server.
iRules – Implement business logic into your network layer by simple scripting and that is iRules. For eg: You can configure to redirect HTTP requests automatically to HTTPS with iRules.
f5 load balancer also has an option to import SSL certificate, wherever required, thereby avoids a scenario to upload the same to all the servers.
The basic structure of load balancer is as shown below:
How does this work:
When a request is received in the virtual server, it checks for any irules applicable for that virtual server and if anything found, the request is modified to complete the irule.
Then the request is passed down to the pools associated within the virtual server. The pool then decides to which node the request has to be passed, since pool constantly monitors the nodes for its availability.
But how does the pool decides the nodes?
These are done by an algorithm defined while creating pools. Default algorithm is Round Robin, but can use any other pre defined or custom method. Some of them are:
1. Round Robin – Default balancing method. Requests are passed to the next server in line, distributing the connections equally across an array of servers.
2. Least Connections – Requests are simply passed to the node that has the least number of current connections.
3. Observed – Difference between least connection and observed is that the least connection method measures connections only at the time of load balancing whereas observed method tracks layer 4 connections count and creates a ratio.
4. Predictive – Uses same approach of observed, where nodes are rated based on number of current connections. With this method f5 system analyzes the performance of nodes, whether it is improving or declining. Performance improving nodes receive a higher proportion of connections.