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.
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.
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:
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.