What is Network Load Balancing (NLB)?
When you browse the internet, there’s an underlying process that’s entirely transparent to you. This process is responsible for routing your requests (such as searches) to the remote server, potentially located on the other side of the world, hosting the website. The response from this server is then returned to you in a very short time, and fortunately, this delay is not dependent on the distance between you and the server.
As the popularity of a website can grow, along with its peak traffic, it’s imperative to maintain your user experience. So, the key question is how to ensure optimal and uninterrupted quality and availability. This is where Network Load Balancing (NLB) comes into play.
Some websites can handle several million requests per day while reliably delivering the desired content, whether it’s text, videos, or other data.
The load balancer’s mission is to route requests to all servers capable of responding, maximizing speed and capacity utilization, ensuring that no server becomes overloaded (which would reduce performance). If a server fails, the load balancer redirects requests to the remaining servers. Conversely, if a new server is added to the group, the load balancer automatically starts sending requests to it.
Loads are distributed based on various criteria, such as the geographical location of users or the number of simultaneous users. Therefore, the load balancer performs the following tasks:
1. Distributes requests or network loads to multiple servers.
2. Ensures availability by forwarding requests only to online servers.
3. Can add or remove servers automatically to adapt to the load.
Algorithms
Several algorithms are available to leverage the benefits of load balancers, depending on the specific requirement:
1. Round Robin: The load is distributed to the server group sequentially.
2. Least Connection: Each new request is sent to the server with the fewest active connections.
3. IP Hash: The client’s IP address is used to determine the server that receives the request.
Load balancers are typically categorized into two types: Layer 4 (L4) and Layer 7 (L7), directly referring to the OSI model layer they operate on. Layer 4 load balancers work on data found at the network and transport layers (IP, TCP, UDP, FTP), while Layer 7 load balancers distribute requests based on data found in application layer protocols (HTTP).
Hardware and software balancers
Two types of Network Load Balancers (NLBs) exist:
1. Hardware NLB: These use specialized hardware devices (such as network switches) to distribute the workload.
2. Software NLB: These use specific software installed on the servers themselves to manage load distribution.
Conclusion
Network Load Balancing (NLB) is a powerful technique for enhancing the performance of your applications by efficiently distributing the workload. The following table presents the key advantages and disadvantages:
Advantages | Disadvantages |
---|---|
Improved availability and performance | Setup and configuration can be complex, requiring technical expertise |
Reduced downtime | Requires specific protection against Denial of Service (DoS) attacks |
Cost reduction |