Algorithm Overview

In per-packet load balancing, a counter is set to count the number of packets. The value of the counter are used for selecting an outbound interface.

Per-flow load balancing uses the hash algorithm. This document focus on the hash algorithm since the per-flow mode is more widely used.

Hash Algorithm

The hash algorithm uses a hash function to map a binary value of any length to a smaller binary value of a fixed length. The smaller binary value is the hash value. The device then uses an algorithm to map the hash value to an outbound interface and sends packets out from this outbound interface.

Hash Factor

Traffic is hashed based on traffic characteristics, which are called hash factors.

Traffic characteristics that can be used as hash factors include but are not limited to the following:

  • Ethernet frame header: source and destination MAC addresses
  • IP header: source IP address, destination IP address, and protocol number
  • TCP/UDP header: source and destination port numbers
  • MPLS header: MPLS label and some bits in the MPLS payload
  • L2TP packets: tunnel ID and session ID

Hash Factors and Load Balancing Effects

If hash factors are more hashable, traffic will be more evenly load-balanced. If network traffic is of varied types, only using hash factors may not achieve the best load balancing results.

To implement load balancing better, you are allowed to configure hash factors based on traffic types. If the most suitable hash factor is used but the load balancing effect still unsatisfactory, you can add the scrambling value to allow the hash factor to be more hashable, and therefore to achieve better load balancing effect.

For the default hash factors of hash algorithm in typical load balance scenarios, see the chapter Appendix: Default Hash Factors.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
Next topic >