How network load balancing works

Source: Internet
Author: User
Tags dedicated ip
Document directory
  • IGMP multicast (IGMP Multicast)

Refer: http://blog.csdn.net/ghj1976/archive/2009/03/17/3997840.aspx

 

Recently, we are studying how to achieve Load Balancing (NLB) for csdn Forum Web servers ). Below is my documents:

How NLB works
Features of the NLB algorithm:
  • In the NLB cluster, each server has its own static IP address, and all servers in the NLB Cluster also have a common IP address-the NLB cluster address;
  • When
    When a customer initiates a request to an NLB cluster (NLB virtual IP address), the request packet is actually sent to all NLB nodes (that is, the NLB algorithm needs to be visible to all hosts in the NLB cluster ).
    To each packet sent to the cluster .), Then, the NLB service running on the NLB node determines whether it should be processed by itself based on the same NLB algorithm. If not, the customer's request data is discarded.
    Package. If yes, it will be processed.
  • Network Load Balancing allows all cluster hosts on a single subnet to simultaneously detect incoming network communication with the cluster IP address. On each cluster host, the network load balancing driver acts as a filter between the cluster Adapter driver and the TCP/IP stack for communication between hosts.

Make sure that the features of the preceding algorithms, unicast and multicast, are as follows:

Unicast (unicast) in NLB)


In unicast mode, NLB re-assigns a MAC address (This MAC address is called the cluster MAC address) to the NLB network adapter enabled for each NLB node, and all NLB nodes use the same
Both use the cluster MAC address and NLB modify the source MAC address in all sent packets so that the switch cannot bind the cluster MAC address to a port.

NLB working in Unicast mode can run normally in all network environments. However, due to its operating characteristics, it has the following two restrictions:

  • Because the cluster MAC address used by NLB is not bound to a specific switch port, all NLB communication is broadcast on all ports of the switch, regardless of whether the port is connected to the NLB node, this causes additional network traffic load;
  • Since all NLB nodes share the same MAC address, NLB nodes cannot communicate with each other through their original private IP addresses.

The unicast mode also has obvious advantages: it can work seamlessly with most routers and switches.

As shown in:

Other notes for unicast:

  • In Windows
    Servers 2003
    In SP1, Microsoft modified the NLB unicast driver to support communication between array members through their original dedicated IP addresses. For more information, see kb898867, unicast
    NLB nodes cannot communicate over an NLB-enabled network adaptor in
    Windows Server 2003.
  • If we select the unicast mode when creating NLB, the "Network Address" in "cluster IP configuration" starts with "02-BF", followed by the hexadecimal representation of the IP address, the network address is the same as the MAC address of the actual host, and the host to be added will also be changed to this MAC address.

Refer:

Single network adapter in Unicast Mode
Http://technet.microsoft.com/zh-cn/library/cc757150.aspx


Multiple network adapters in Unicast Mode
Http://technet.microsoft.com/zh-cn/library/cc786134.aspx

Multicasting in NLB)

In multicast mode, NLB does not modify the MAC address of the NLB node's network adapter that enables NLB, instead, it allocates a layer-2 multicast MAC address for NLB communication (This MAC address is called the cluster MAC address), so that NLB nodes can communicate with each other through their original private IP addresses.


However, in multicast mode, the address resolution
Protocol, Address Resolution Protocol) The requested ARP reply will map the cluster IP address to the multicast MAC address, and many routers or switches (including Cisco products) will reject this line.
Yes. In this case, you must manually add a static ing on the vro and vswitch to map the cluster IP address to the multicast MAC address of the cluster.

The advantage of this mode is that you can create static items in the "Content Addressable Storage" (CAM) Table of the switch so that inbound traffic only reaches the host in the cluster.


The disadvantage is that many routers do not automatically associate the unicast IP address (the virtual IP address of the cluster) with the multicast MAC address.
Address. Some routers can have such associations if static configurations are performed. If we select multicast mode when creating NLB, the network address in "cluster IP configuration" is "03"
-BF, followed by the hexadecimal representation of the IP address.

As shown in:

 

 

 

 

IGMP multicast (IGMP Multicast)


The NLB algorithm requires that all hosts in the NLB cluster can view each packet sent to the cluster. NLB does not allow the switch to associate the cluster's MAC address with a specific port of the switch.
. However, this approach will also bring unwanted side effects, that is, all data packets sent to the NLB cluster will cause a "Flood" of data on all ports on the switch ". This is not only troublesome, but will certainly
Network resources are wasted.

To solve this problem, a new feature called IGMP support was introduced to Windows server.
2003. This feature helps to restrict data flooding to the ports connected to the NLB computer on the switch. In this way, non-NLB computers do not see data sent to the NLB cluster,
At the same time, all NLB computers can see the data sent to the cluster, thus meeting the requirements of the NBL algorithm. However, it should be pointed out that IGMP supports multicast only when NLB is configured.
(Multicast) mode.

When you select multicast mode, there is a repeat option "IGMP
Multicast (IGMP Multicast) ". If this option is selected, NLB retains the original MAC address, but adds
IGMP multicast address. In addition, the NLB host sends an IGMP message for this group. If the switch detects these messages, it can use the desired multicast address to fill in its own
In this way, the inbound traffic will not spread to all ports on the VLAN. This is the main advantage of this cluster mode. Some switches do not support IGMP.
Detection. In addition, the vro still supports converting unicast IP addresses to multicast MAC addresses. In IGMP multicast mode, "01-00-
MAC address starting with 5E. In multicast mode, physical hosts can communicate with each other.

As shown in:

 

Router requirements of NLB

When the cluster is configured to work in multicast mode, if the network load balancing client is accessing a cluster through a vro, make sure that the vro meets the following requirements:

  • Accept the Address Resolution Protocol (ARP) response, which has a Media Access Control (MAC) address in the ARP structure's payload section, but as determined by the Ethernet header, it looks like a website with another MAC address.
  • Receives an ARP response from the unicast IP address. This response has a multicast MAC address in the payload section of its ARP structure.

The unicast mode does not require a vro.

 

 

Refer:

Single network adapter in multicast Mode
Http://technet.microsoft.com/zh-cn/library/cc759683.aspx

Multiple network adapters in multicast Mode
Http://technet.microsoft.com/zh-cn/library/cc779600.aspx

 

Appendix: differences between Unicast (unicast), multiccast (Multicast), and broadcast (broadcast:

Unicast:

Master
One-to-one communication mode between machines. switches and routers in the network only forward data without copying. If 10 clients need the same data, the server needs to transmit the data one by one and repeat the data for 10 times.
Same job. However, because it can respond to each customer in a timely manner, all current web browsing uses the IP Unicast protocol. The vro and vswitch in the network select the transmission path based on the target address
IP Unicast data is transmitted to the specified destination.
Advantages of unicast:
1. The server responds to client requests in a timely manner.
2. The server can easily implement personalized services by sending inaccessible data to requests of each customer.
Disadvantages of unicast:
1. the server sends data streams to each client. The server traffic is equal to the number of clients × client traffic. The server is overwhelmed in streaming media applications with a large number of customers and high traffic per client.
2. The existing network bandwidth is a pyramid structure. The inter-city backbone bandwidth is only equivalent to 5% of the total bandwidth of all its users. If all the unicast protocols are used, the network trunk will be overwhelmed. Now, P2P applications have frequently congested the trunk. As long as 5% of customers use the network at full speed, no one else needs to play. It is almost impossible to expand the trunk by 20 times.

Multicast (Multicast ):

Master
One-to-one communication mode between hosts, that is, hosts added to the same group can receive all data in the group, vswitches and vrouters in the network only copy and forward the required data to the demanders. Host
You can request a vro to join or exit a group. The vrouters and vswitches in the network can copy and transmit data, that is, only the data in the group is transmitted to those hosts in the group. In this way, data can be transmitted to multiple
Hosts that need to be (added to the group) can ensure that other communications between hosts that do not need to be (not added to the group) are not affected.
Advantages of Multicast:
1. clients with the same data stream need to join the same group to share a data stream, saving the server load. It has the advantages of broadcast.
2. Because the multicast protocol replicates and forwards data streams based on the receiver's needs, the total service bandwidth of the server is not limited by the bandwidth of the client access end. The IP protocol supports over 0.2 billion 268435456 () multicast packets, so it provides a wide range of services.
3. This protocol is the same as the unicast protocol that allows transmission over the internet broadband network.
Disadvantages of Multicast:
1. Compared with the unicast protocol, there is no error correction mechanism and it is difficult to make up for packet loss errors, but it can be compensated through a certain Fault Tolerance Mechanism and QoS.
2. although the current network supports multicast transmission, it still needs to be improved in terms of customer authentication and QoS. These shortcomings have mature solutions theoretically, it only needs to be gradually applied to existing networks.

Broadcast:

Master
One-to-all communication mode between hosts. The network copies and forwards signals from each host unconditionally, all Hosts receive all the information (whether or not you need it ),
Path Selection, so the network cost can be very low. A cable TV network is a typical broadcast network. Our TV actually receives signals from all channels, but only restores signals from one channel to a screen. Number
Broadcast is allowed in the network, but it is restricted within the LAN of a layer-2 switch. Broadcast Data is prohibited from passing through the router to prevent the broadcast data from affecting hosts in a large area.
Broadcast advantages:
1. Simple network equipment, simple maintenance, and low network deployment cost
2. Because the server does not need to send data separately to each client, the server traffic load is extremely low.
Disadvantages of broadcast:
1. Unable to provide personalized services in a timely manner based on the requirements and time of each customer.
2.
The network allows the server to provide data with limited bandwidth. The maximum bandwidth of the client = the total bandwidth of the service. For example, the cable TV client line supports 100 channels (IF digital compression technology is used, theoretically it can provide
500 channels), even if the service provider has more financial resources to configure more sending devices and change them to the fiber trunk, the limit cannot be exceeded. That is to say, it is impossible to provide more diversified and personalized services to many customers.

3. Broadcasting is prohibited from being transmitted over the Internet broadband network.

References:
 

Load Balancing and ASP. NET
Http://www.hanselman.com/blog/LoadBalancingAndASPNET.aspx

Web farming with the network load balancing service in Windows Server 2003
Http://www.west-wind.com/presentations/loadbalancing/NetworkLoadBalancingWindows2003.asp

What is the network load balancing algorithm inside works?
Http://support.microsoft.com/kb/556068/zh-cn? Spid = 3198 & SID = 770

Web farm-load balancing in Asp.net
Http://www.c-sharpcorner.com/UploadFile/gopenath/Page107182007032219AM/Page1.aspx

How to test web Load Balance
Http://www.cnblogs.com/oscarxie/archive/2008/05/20/1203157.html

Steps for migrating Asp.net to load balance and NAS
Http://blog.joycode.com/hopeq/archive/2006/03/29/73762.aspx

Summary of articles on Server Load balancer in Microsoft Knowledge Base
Http://support.microsoft.com/ph/3198/zh-cn? SID = 770 & Aid = 1 & gsa_ac_more1

Technet content about network load balancing Clusters
Http://technet.microsoft.com/zh-cn/library/cc759510.aspx
Chinese
Http://technet.microsoft.com/en-us/library/cc759510.aspx
English

The working principle of Server Load balancer is discussed in the following article.
Http://technet.microsoft.com/zh-cn/library/aa998796%28EXCHG.65%29.aspx

Differences between unicast and multicast in NLB Configuration
Http://hi.baidu.com/hneli/blog/item/656725d3e5471433970a16bd.html

NLB Cluster
Http://blog.sina.com.cn/s/blog_4b611a45010009hh.html

Using NLB with ISA Server Part 2: Layer 2 fun with unicast and multicast Modes
Http://www.isaserver.org/articles/basicnlbpart2.html

IP multicast Overview
Http://www.microsoft.com/china/technet/community/columns/cableguy/cg0202.mspx

TCP/IP Study Notes-broadcast and Multicast
Http://blog.csdn.net/kmajian/archive/2008/11/27/3389667.aspx

Key features of network load balancing
Http://technet.microsoft.com/en-us/library/cc758275.aspx

Network Load Balancing
Http://www.msxfaq.de/verschiedenes/nlb.htm

Network Load Balancing technical overview
Http://technet.microsoft.com/zh-cn/library/bb742455 (En-US). aspx

Basic knowledge of network technology-ARP Protocol Overview
Http://cisco.chinaitlab.com/TCP/38035.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.