Tuesday, 18 October 2011

ESXi 5.0 Load Balancing Test: Route based on the originating virtual port ID

Within ESXi 5.0, there are 4 methods of Load Balancing.  As stated in the help

Route based on the originating port ID
Select an uplink based on the virtual port where the traffic entered the standard switch.

Route based on ip hash
Select an uplink based on a hash of the source and destination IP addresses of each packet. For non-IP packets, whatever is at those offsets is used to compute the hash.

Route based on source MAC hash
Select an uplink based on a hash of the source Ethernet.


Use explicit failover order
Always use the highest order uplink from the list of Active adapters that passes failover detection criteria.


This test is to review what "Route based on source MAC hash" does and how it perform the required traffic load balancing.

Below is my setup6 XP virtual machines connected to 2 port groups into vSwitch1.  3 pNIC connected to vSwitch1.

In the vSwitch NIC Teaming Setup




The command "esxtop" follow by "n" is used to check the load balancing of the MAC hash effect on the physical nic.




As the MAC hash is depending on the Client Virtual MAC Addess, I use the following command to extract the current Client Virtual MAC Address.






I am using my NAS box for this test, each XP Virtual Machine connects to my NAS Box and copy 1GB files down to it's C: drive.  I then use esxtop "n" to look at the actual vmnic used during the copy process.

TestXP01, uses vmnic1 to send traffic

TestXP02, uses vmnic2 to send traffic

TestXP03, uses vmnic3 to send traffic
 

TestXP04, uses vmnic1 to send traffic


TestXP05, uses vmnic2 to send traffic

TestXP06, uses vmnic3 to send traffic


The above test result show that all the outgoing and incoming traffic of a virtual machine uses the same physical NIC.

There are no documents as how ESXi calculate the MAC hash.  So, I done some assumtion and came out with the following MAX hash.  And I think I am right.




What I did was to convert the Virutal Machine MAC Address to Decimal Value.  I then perform a Remainder to get the "hash" value.  As my vmnic start with 1, I then add "1" to the value.  This is what I got in the Excel.

Excel Formaul for those what want to create such spreadsheet.

The Source MAC is a Text field.  You will have to remove the "0" in front.

The Souce MAC is a function =HEX2DEC(C7), where C7 is the Source MAC in Text.

The Remainder is a function =MOD(D7,C4), where D7 is the Source MAC in Decimal and C4 is the Total NIC.


Conclusion

The calculated result matched the actual vmnic.



 

2 comments:

  1. this is great!
    Thanks for sharing

    ReplyDelete
  2. Hi,

    I tested this out using vSphere ESXi 6.0.
    For the "Source MAC Hash" is not working as per your formula above.
    The bind gave me unexpected results... you can try it out.
    I don't have formula as well, but if i do, of course i will share here.

    Regards,
    Phil




    ReplyDelete