1.1.b (ii) Load Balancing Hash

Each switching path has different capabilities when it comes to load balancing:
Process switching (slowest) can only do per packet load balancing (ewww out of order packets)
Fast switching (per flow) much better but not perfect
CEF switching utilizes a per packet hash which results in a per flow behavior. (Can utilize per packet but not recommended)

Load share table:

CEF is able to load balance but introducing the concept of a loadshare table (both software and hardware CEF use this).
This table logically sits in between the FIB and adjacency table.

When a packet arrives, the router takes a hash of the Router’s Universal ID, the packets source and destination addresses.
Note: You will learn about the universal ID later on in 1.1.b (iii).
Moving on, once the router computes the hash it assigns this hash to an entry in the load share table.
Now this entry has 16 pointers, either all pointing to the same adjacency table entries, or to multiple if multiple paths exist.
If 2 paths exist for one flow (hash), 8 loadshare pointers point to 1 adjacency table entry, and 8 point to the other.
If 3 paths exist the points are split by 5.

Now let’s say for example we have 20 packets in a flow (unidirectional, no return traffic, , with 2 equal cost destinations.
Since they will all equal the same hash, they will be placed in one loadshare table index/entry. Now that entry has 16 pointers available to it.
These are split up, 8 pointing to one adjacency table entry, 8 pointing to another.
The first 8 packets, go to 1 adjacency table entry, the next 8 go to the other. Then this repeats, until we run out of packets.

Note you can change CEF’s load sharing behavior to per packet on software based routers (low end ISR with no asics) via this interface command:
ip load-share per-packet

Higher end routers with ASICs or L3 switches cannot change this as it would require reprogramming ASICs.

Leave a comment