Saturday, July 19, 2014

Polarization concept and avoidance


Polarization concept and avoidance

CEF polarization

Its the effect when a hash algorithm chooses a particular path and the redundant paths remain completely unused.
2 equal cost path to a Destination, decision is made by a hashing algorithm , which uses XOR on  lower bits of SIP/DIP to select one link
which turns out the same across all Nodes in the path.

Use of the same hash algorithm and same hash input which results in the use of a single Equal-Cost Multi-Path (ECMP) link for ALL flows

Note: X-OR  matches one or the other but not both when two path are available

Avoid CEF polarization
1.-Alternate between default (SIP and DIP) and full (SIP + DIP + Layer4 ports) hashing inputs configuration at each layer of the network.
6500 provides
Default  SIP/DIP with unequal weights to each link
Simple SIP/DIP with equal weights
Full SIP/DIP + L4 with unequal weights
Full Simple SIP/DIP + L4 with equal weights


To configure

 #mls ip cef load-sharing simple   
 #mls ip cef load-sharing  full simple  


2.- Alternate between even and odd numbers of ECMP links at each layer of the network as
when there is even number of ECMP links, the traffic is not load-balanced

For four equal cost paths, load-sharing is 20%-20%-20%-40% and not 25%-25%-25%-25%

In order to enable anti-polarization weight, enter this command :


 # mls ip cef load-sharing full simple  

3.- Cisco IOS introduced a concept called unique-ID/universal-ID <--- Default in all IOS version

  •    adds a 32-bit router-specific randomly  value to the hash function
   This seeds the hash function on each router with a unique ID, which ensures that the SIP/DIP pair hash have a different value on different routers along the path

 (config)#ip cef load-sharing algorithm universal <id>  




4 comments:

  1. It seems you are missing the anti polarization weight...

    ReplyDelete
  2. Oops, no, its there but hides below the alternate # of links. It's a different technique though, and as far as I understand it, the command "disables" it (its enabled by default)

    ReplyDelete
  3. FYI- the "mls cef..." commands only work on the 6500/7600 platform. For other platforms you should use just "ip cef..."

    ReplyDelete
  4. Hello, one question about the hashing algorithm...
    According to https://www.cisco.com/c/en/us/support/docs/ip/express-forwarding-cef/116376-technote-cef-00.html
    I understand the outcome of load-balancing with ECMP.
    I´d like to know more about the how. Please if someone can point to my mistake in the following example:

    - 1st flow: 10.240.18.1 to 10.240.20.1; with 2 ECMP (let´s say Path 0 and Path 1), need an XOR in the last bit 00000001 XOR 00000001 = 00000000. So the result is Path 0. OK.
    - 2nd flow: 10.240.18.2 to 10.240.20.1; with the same 2 ECMP... 00000010 XRO 00000001 = 00000011; last resulting bit = 1, so Path 1 is chosen. OK.
    - 3rd flow: 10.240.18.3 to 10.240.20.1; with the same 2 ECMP... 00000011 XOR 00000001 = 00000010; last resulting bit = 0, so Path 0 SHOULD be used, but instead Path 1 is chosen...

    So why? how does it come to use a load-balancing of 46.7% / 53.3% instead of 50/50?

    ReplyDelete