network load balancing (NLB)
What is network load balancing (NLB)?
Network load balancing (NLB) is a feature in multiple versions of the Microsoft Windows Server operating system (OS), Amazon Web Services (AWS) and other cloud service providers that distribute network traffic among multiple servers or virtual machines (VMs) within a cluster to avoid overloading any one host and improve performance.
Network load balancing is a capability provided in most public clouds and cloud services, including AWS, and the Windows Server OS. A network load balancer disburses processing loads and network traffic across multiple targets, such as servers or instances, by opening a TCP connection to the selected targets.
In Windows, NLB can be used to manage two or more servers as one virtual cluster. In AWS, the NLB feature distributes incoming traffic across multiple targets, such as Amazon Elastic Compute Cloud instances.
Why is network load balancing used?
NLB is used to distribute or balance network traffic across multiple servers or VMs. In doing so, it prevents the overloading of any single host. It also increases the reliability and performance of applications, mission-critical servers and other targets. Network load balancing can be used on web servers, File Transfer Protocol servers, proxy servers, firewall servers and virtual private networks.
NLB is especially useful for stateless applications, such as web servers running Internet Information Services. By seamlessly routing traffic and distributing server load to available hosts, NLB ensures these services remain highly available with minimal downtime.
Network load balancing at OSI Layer 4 and Layer 7
NLB is available at both the transport layer and application layer of the OSI (Open Systems Interconnection) network model. The transport layer, or Layer 4, manages communications and data transfers between hosts and endpoints, supports quality of service functions, and manages end-to-end error recovery. The application layer, or Layer 7, enables applications to communicate with each other on different computer systems and networks.
In the transport layer, NLB does not need to use complex routing protocols or encrypt/decrypt traffic to make routing decisions. If anything, it uses simple algorithms such as round robin routing to quickly and efficiently perform packet-level load balancing, while easily handling millions of routing requests per second. NLB only needs information about the protocol, source ports and destination ports to route packets. It cannot inspect or decrypt messages, and therefore cannot route traffic based on more complex criteria, such as localization rules or media type.
More complex NLB is possible in the OSI application layer. In this layer, the load balancer inspects the contents of each message and makes more granular routing and forwarding decisions based on that information. It can also decrypt messages, terminate sessions, cache frequently accessed content and initiate new TCP sessions to upstream servers. Owing to all these capabilities, Layer 7 NLB supports intelligent routing, more efficient traffic distribution and easier content retrieval.
Network load balancing in Windows Server
The NLB feature is available in Windows Server 2022, Windows Server 2019 and Windows Server 2016. In all these OSes, NLB combines multiple computers or servers, known as hosts, into a single virtual cluster. Each host runs a separate copy of the server OS.
Windows NLB routes incoming client requests to these different hosts in the cluster based on an administrator's settings and a proprietary Microsoft distribution algorithm. It can also direct all traffic to a single default host. Regardless of which host it routes traffic to, NLB in Windows Server uses the TCP/IP networking protocol to enable the routing. Also, all NLB operations are transparent to the TCP/IP stack.
Windows Server provides the flexibility to configure the NLB according to a user's or an organization's needs. For example, administrators can articulate the maximum load that a given host can handle. If the load increases -- or is expected to increase -- admins can add hosts to the cluster as needed.
In Windows Server, systems administrators and network administrators can manage the network load balancing feature through Microsoft's NLB Manager or with PowerShell cmdlets. In addition, all NLB events and cluster changes are documented in the Windows Event Log, which further helps with the management of NLB in Windows Server.
Network load balancing in Amazon Web Services
AWS Elastic Load Balancing supports network load balancing alongside other types of load balancers, such as application load balancers and gateway load balancers. Administrators are free to choose the load balancers they need for their specific requirements.
AWS Network Load Balancer consists of a listener and a target group. The listener's role is to detect connection requests from clients and then forward those requests to the target group. The target group receives the request from the listener and then routes it to a registered target using TCP, UDP, TCP_UDP or TLS. The user must specify the protocol and port number before the target group can route the connection request to the registered target. NLB selects the target using a flow hash algorithm and various parameters, such as the protocol, source IP address and port, and destination IP address and port.
In AWS, NLB distributes traffic among registered targets across load balancer availability zones (AZs) by default. However, if the user enables cross-zone load balancing, NLB can distribute traffic across registered targets in all enabled AZs.
What are the benefits of network load balancing?
Network load balancing has several use cases and advantages. By distributing network traffic across multiple servers or VMs, traffic can be processed faster than by flowing through a single server.
The feature can also enable an organization to quickly scale up a service, such as a web server, by adding hosts and then distributing the traffic among the new hosts. Similarly, if demand decreases, servers can be taken offline, and NLB will rebalance traffic among the remaining hosts. If a host within a cluster fails, network load balancing can also avoid service disruptions by rerouting traffic to other available hosts.
In summary, there are several benefits of NLB:
- It provides improved application availability, delivery, performance and scalability.
- If a host fails or goes offline, the load is automatically redistributed among the other available hosts within a few seconds to minimize downtime and prevent application failure.
- Systems can be added easily to existing clusters to handle additional load and satisfy new performance demands.
- Administrators can perform preventive maintenance activities on hosts without disturbing the other hosts.
- It supports static IP addresses, automatic addition of hosts to a cluster and configuration of multiple independent clusters on each host.
Check out best practices to achieve high availability in cloud computing, read about virtual network load balancing tools and tips and explore the differences between load sharing vs. load balancing. See how to configure Azure Load Balancer for session persistence and check out tricks to help manage load balancing in microservices.