Monday, December 15, 2014

Notes: How Does Load Balancing Work?

My previous post examined how routes are installed in the routing table and which one is used when making a forwarding decision. It was stated that if a router learns multiple paths to the same destination with the same metric from the same routing protocol, it will install all equal-cost paths into the routing table and load balance between them. This post will look at the load balancing procedure more closely.

Introduction

  • Load balancing is a standard functionality in the Cisco IOS router software.
  • Available across all router platforms.
  • Inherent to the forwarding process, and is automatically activated if the routing table has multiple paths to a destination.

Load-Balancing

  • Limited number of equal-cost entries the routing protocol puts in the routing table.
  • Four entries is the default for most IP routing protocols.
  • BGP is the exception, where only one entry is the default.
  • Six different paths configured is the maximum number.
  • EIGRP also supports unequal-cost load-balancing.
  • The variance command accomplishes unequal-cost load-balancing.
  • The maximum-paths command determines the number of routes that can be installed based on the value configured for the protocol.
  • If the routing table is set to only one entry, load balancing is disabled.
  • Use show ip route to find equal-cost routes.

Router# show ip route 1.0.0.0
Routing entry for 1.0.0.0/8
  Known via "rip", distance 120, metric 1
  Redistributing via rip
  Advertised by rip (self originated)
  Last update from 192.168.75.7 on Serial1, 00:00:00 ago
  Routing Descriptor Blocks:
  * 192.168.57.7, from 192.168.57.7, 00:00:18 ago, via Serial0
      Route metric is 1, traffic share count is 1
    192.168.75.7, from 192.168.75.7, 00:00:00 ago, via Serial1
      Route metric is 1, traffic share count is 1


  • There are two routing descriptor blocks.
  • Each block is one route.
  • An asterisk (*) next to one of the block entries corresponds to the active route that is used for new traffic.
  • New traffic corresponds to a single packet or an entire flow to a destination, depending on the type of switching configured.
  • For process-switching - load balancing is on a per-packet basis and the asterisk (*) points to the interface over which the next packet is sent.
  • For fast-switching -  load balancing is on a per-destination basis and the asterisk (*) points to the interface over which the next destination-based flow is sent.
  • The position of the asterisk (*) keeps rotating amont the equal-cost paths to each time a packet/flow is served.

Per-Destination Load Balancing

  • Per-destination load balancing means that the router distributes the packets based on the destination address.
  • Given two paths to the same network, all packets for A on that network go over the first path, all packets for B on that network go over the second path, and so on.
  • This preserves packet order, with potential unequal usage of the links.
  • To achieve more equally used links, the IOS builds a route-cache entry for every destination address, instead of every destination network (as is the case when only a single path exists).
  • Traffic for different hosts on the same destination network can use different paths.
  • As a downside, the memory and processing requirements for maintaining the cache on core routers, which carry traffic for thousands of destination hosts, becomes very demanding.

Per-Packet Load Balancing

  • Per-packet load balancing means that the router sends one packet fro A over the first path and the second packet for A over the second path, and so on.
  • Guarantees equal load across all links.
  • However, the packets may arrive out of order at the destination.
  • Disables the forwarding acceleration by a route cache, because the route cache information includes the outgoing interface.
  • The forwarding process determines the outgoing interface for each packet by looking up the routing table and picking the least used interface.
  • Ensures equal utilization of the links, but is a processor-intensive task and impacts the overall forwarding performance.
  • Not well-suited for higher speed interfaces.

Switching Method

  • Per-destination or per-packet load-balancing depends on the type of switching scheme used for IP packets.
  • By default, on most Cisco routers, fast switching is enabled.
  • This is a demand caching scheme that does per-destination load-balancing.
  • To set per-packet load-balancing, enable process switching by disabling fast switching (no ip route-cache).
  • Now the router CPU looks at every single packet and load balances on the number of routes in the routing table for the destination.
  • This can crash a low-end router because the CPU must do all the processing.
  • Newer switching schemes like Cisco Express Forwarding (CEF) allows the router to do per-packet and per-destination load-balancing more quickly.
  • Requires extra resources to deal with maintaining CEF entries and adjacencies.

References

How Does Load Balancing Work?

No comments:

Post a Comment