Network Load Balancing Clusters

The Windows family of operating systems (not so recently) introduced Network Load Balancing (NLB), but I wasn't game enough to try them in a production environment. Even seven years ago, Rick Strahl of west-wind wrote a top article on the very same topic, but still I wan't game.

However, having seen product mature (and in Win2K8, an improved management application), the opportunity came along and I jumped !

Some background ... transcripted from techotopia ..

Network Load balancing provides failover and high scalability for Internet Protocol (IP) based services providing support for Transmission Control Protocol (TCP), User Datagram Protocol (UDP) and General Routing Encapsulation (GRE) traffic.

Each server in a cluster is referred to as a node. Windows Server 2008 supports clusters from 2 up to a maximum of 32 nodes.

Network Load Balancing assigns a virtual IP address to the cluster. When a client request arrives at the cluster, this virtual IP address is mapped to the real address of a specific node in the cluster based on configuration settings and server availability. When a server fails, traffic is diverted to another server in the cluster. When the failed node is brought back online it is then re-assigned a share of the load. From a user perspective the load balanced cluster appears to all intents and purposes as a single server represented by one or more virtual IP addresses.

The failure of a node in a cluster is detected by the absence of heartbeats from that node. If a node fails to transmit a heartbeat packet for a designated period of time, that node is assumed to have failed and the remaining nodes takeover the work load of the failed server.

This is wonderful for stateless applications (assuming you've written it appropriately), and will allow the application to scale out by adding extra nodes into the cluster. In my particular instance, the NLB was providing the clustering for a Service Layer across two nodes.

The interesting point to note is how you configure the traffic routing across the nodes: these rules are encapsulated in the port rules you define. The settings to pay attention to are the 'Filtering Mode" options.

The Filtering Mode options are:

  • Single Host - Traffic to the designated port (or port range) is forwarded to a single node in the cluster.
  • Multiple Hosts - Traffic to the designated port (or port range) is distributed between the nodes in the cluster.
  • Disabled - No filtering is performed.

Within the "Multiple Hosts" option, you can further control the affinity of the client. You can select one of the following options:

  • Single - Requests from a single source IP address are directed to the same node. (The default .... be careful as you may not want this!)
  • Network - Requests originating from within the same Class C network address range are directed to the same node.
  • None - No client affinity. Requests are directed to nodes regardless of previous assignments.

With these two options in mind, you can easily configure NLB to cater for stateless and stateful applications. So, stateless would be "Multiple Hosts" with the "None" option, and stateful would be "Multiple Hosts" with the "Single" option.

Convinced yet?

If so, I recommend a thorough read of Rick Strahl's article Web Farming with the Network Load Balancing Service in Windows Server 2003 as it provides lots of detail regarding the implementation. Of course, TechNet is always an invaluable guide.

Enjoy!

No Comments