CEF Polarization

This topic is to discuss the following lesson:

Hi Rene,
Thanks for your very nice article.
Please clarify ""If we use different hashing algorithm then the flow will be considered based on different parameter but same flow will use the same link,Not possible any load balance using different hashing algorithm , right ??? and if we use “ip load-sharing per-packet” at interface level then all packet will push across all available link . we can influence Load Balance , right ??
So In summary…

  1. Different hashing algorithm : Only flow will be consider based on different parameter like Src IP/dst IP/L4 Port etc.
  2. ip load-sharing per-packet at interface level : Per-Packet will be load balance across all link even though the packets are belong to same flow .

br//zaman

Hi Zaman,

What I mean by this is that for a single flow, the router always selects the same interface no matter the hash algorithm you use. The advantage of using a hash algorithm that uses more parameters is that you will have better load balancing since different flows will use different interfaces. For example, if you use a hashing algorithm that only includes source and destination IP address then it’s likely that the following flows will all get the same result and use the same outbound interface.

Here’s a quick example, let’s say we have these flows:

192.168.1.1 > 192.168.2.2
192.168.1.2 > 192.168.2.2
192.168.1.3 > 192.168.2.2
192.168.1.4 > 192.168.2.2
192.168.1.5 > 192.168.2.2
192.168.1.7 > 192.168.2.2
192.168.1.9 > 192.168.2.2

If we had two outgoing interfaces, it would be nice to see 4 flows on each interface so that we have some load sharing. However in reality, it’s likely that the flows get mapped like this:

INTERFACE 1:

192.168.1.1 > 192.168.2.2
192.168.1.3 > 192.168.2.2
192.168.1.5 > 192.168.2.2
192.168.1.7 > 192.168.2.2
192.168.1.9 > 192.168.2.2

INTERFACE 2:

192.168.1.2 > 192.168.2.2
192.168.1.4 > 192.168.2.2

In this case, interface 1 gets the most flows. By using a hashing algorithm with more parameters, the chance that each interface gets 50% of the flows increases. Still, this doesn’t consider how much traffic each flow has so it’s more like “flow” balancing than load balancing :slight_smile:

Per packet load balancing does evenly share the load, even though the packets belong to the same flow yes.

“Universal: each router generates a unique 32 bit universal ID that is used as a seed in the hashing algorithm next to the source/destination IP addresses. Since each router will have a unique universal ID, each router will have a different hashing result and a different interface will be selected for each flow”

how??? if the unique ID is same for all flows ?

also can you clarify what d you mean by flow in this article?

Hello Avid

When the term “flow” is used, it is referring to traffic that has the same source and destination address. So in both diagrams in the lesson, there are two flows: one from H1 to H3 and a second from H2 to H3.

Each router has a unique ID that is used for this algorithm. This means that for flow H1 to H2 for example, R1’s algorithm would send the flow via interface 1, R2s algorithm will send the flow via interface 2, R3’s algorithm will send it via interface 3 and so on. In other words, each router would calculate a randomly different exit interface. Conversely, the original algorithm would cause all routers to send the specific flow via the same interface, which can result in CEF polarization.

Now with the displayed examples containing two flows, the benefits of this are not immediately visible. Imagine you have 100 flows, or 1000 flows. The resulting algorithm will more appropriately distribute flows across multiple paths to more efficiently load balance traffic.

I hope this has been helpful!

Laz

Thank you so much!!! its Clear now.

1 Like