Home Search Center Intelligent Model Selection IP Encyclopedia

What Is Load Balancing?

Load balancing enables a network node to distribute traffic to multiple links for forwarding, improving system availability, reliability, and performance.

What Problems Does Load Balancing Solve?

On a network, servers and nodes typically have limited computing and storage capabilities. Due to unbalanced traffic forwarding, some servers and nodes may be overloaded while others remain relatively idle. This reduces the computing and storage capabilities of the network, and may result in single points of failure. To maximize the utilization of such capabilities of servers and nodes while also ensuring system stability and security, load balancing is introduced.

Classification of Load Balancing

Load balancing can be performed based on routes, tunnels, or trunks.

  • Route load balancing

    This type of load balancing enables traffic to be balanced among multiple forwarding paths to the same destination.

    Currently, Huawei routers support load balancing of the following types of routes: RIP, RIPng, OSPF, OSPFv3, IS-IS, BGP, and static routes.

    To implement load balancing among multiple routes, these routes must be equal-cost routes. However, determining whether the routes of different routing protocols are equal-cost is difficult. As such, load balancing is performed only among routes that belong to the same routing protocol.

  • Tunnel load balancing

    This type of load balancing, when used on a VPN, enables traffic to be balanced among the ingress PE's multiple tunnels that are destined for the same destination PE. MPLS VPN supports the following types of tunnels:

    • Label switched path (LSP): includes LDP LSP, BGP LSP, and static LSP.
    • Constraint-based routed label switched path (CR-LSP): includes RSVP-TE CR-LSP and static CR-LSP. Compared with LSPs, CR-LSPs meet specified constraints, such as bandwidth or path constraints.
    • Generic Routing Encapsulation (GRE) tunnel: GRE-encapsulated data packets are transparently transmitted over a public IP network.

    The priority of a tunnel type depends on its configuration sequence. A tunnel type configured earlier takes priority over one configured later. Tunnel load balancing can be performed among different types of tunnels or unequal-cost tunnels — two tunnels can even pass through the same path.

  • Trunk load balancing

    This type of load balancing enables traffic to be balanced among multiple member links of a trunk after multiple physical interfaces with the same link layer protocol are bundled into the trunk. There are two modes: static LACP mode and manual load balancing mode.

    • In static LACP mode, LACP determines active and inactive links in a LAG. This mode is also called the M:N mode, where M indicates the number of active links and N indicates the number of backup links. It provides higher link reliability and allows load balancing to be performed among M links.
    • In manual load balancing mode, you need to manually create a trunk interface and add physical interfaces to it — all member interfaces can then evenly balance traffic. You can also set weights for member interfaces so that some interfaces handle more traffic than others do. If an active link fails, the remaining active links in the LAG automatically balance traffic evenly or based on weights.

Working Modes of Load Balancing

Load Balancing Modes

Per-flow and per-packet load balancing

Per-flow load balancing classifies packets into different flows based on certain rules, such as the IP 5-tuple (source IP address, destination IP address, protocol number, source port number, and destination port number). Packets of the same flow are forwarded over the same link. The following figure shows per-flow load balancing.

Per-flow load balancing
Per-flow load balancing

Per-packet load balancing evenly distributes packets among links used for load balancing based on the sequence in which the packets are received. The following figure shows per-packet load balancing.

Per-packet load balancing
Per-packet load balancing

Per-packet load balancing distributes packets more evenly than per-flow load balancing does. The effect of the latter varies according to load balancing rules and service traffic characteristics.

Because per-packet load balancing may result in out-of-order packet delivery, it is not applicable to some services that are sensitive to packet order. Currently, Huawei routers use per-flow load balancing by default.

ECMP and UCMP

Equal-cost multi-path (ECMP) evenly balances traffic among multiple equal-cost paths to the same destination, irrespective of bandwidth. Equal-cost paths have the same cost to the destination.

ECMP networking
ECMP networking

Unequal-cost multi-path (UCMP) balances traffic among multiple equal-cost paths to the same destination based on bandwidth ratios.

UCMP networking
UCMP networking

If the bandwidth of different paths differs significantly, ECMP has low bandwidth utilization. Conversely, UCMP can balance traffic based on bandwidth ratios, improving bandwidth utilization.

Load Balancing Algorithm

In per-packet load balancing mode, a device starts a timer and increases the counter by 1 each time the device receives a packet. The device selects an outbound interface based on the counter's value.

In per-flow load balancing mode, a device uses a hash algorithm 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 maps the hash value to an outbound interface and sends packets out from this interface.

Traffic is hashed based on its characteristics, which are called hash factors. Such factors include the following:

  • Ethernet frame header: source and destination MAC addresses
  • IP header: source IP address, destination IP address, and protocol number
  • TCP/UDP header: source and destination port numbers
  • MPLS header: MPLS label and some bits in the MPLS payload
  • L2TP packets: tunnel ID and session ID

The more hashable these hash factors are, the more evenly traffic is balanced. If network traffic is very complex and hash factors are used for hashing, it may be difficult to achieve the optimal load balancing effect.

Typical Application Scenarios of Load Balancing

Link Expansion Scenario

As shown in the following figure, R1 and R2 are connected through four 10G links. These two devices establish an EBGP peer relationship through loopback interface addresses and use IGP equal-cost routes. Due to service development, one 40G link needs to be added. As a result, load balancing needs to be implemented among the four 10G links and one 40G link.

Link expansion scenario
Link expansion scenario

In this scenario, you can globally enable UCMP on each device, and then enable UCMP on the corresponding four 10G interfaces and 40G interface of each device.

If a device does not support UCMP, you can configure four IP addresses on the 40G interface to communicate with the peer device. In this way, each 10G interface has one next hop, and the 40G interface has four next hops, implementing IP load balancing.

BGP Load Balancing in an RR Scenario

As shown in the following figure, a route reflector (RR) is deployed in AS 100. After learning external network routes from two egress routers, the RR selects the optimal route from the routes and then transmits it to clients R1, R2, ..., and Rn. Each client has equal-cost uplinks to the two egress routers. In this case, the next hops of the external network routes learned by the clients are either egress router 1 or egress router 2. As a result, load balancing cannot be implemented.

BGP load balancing in an RR scenario
BGP load balancing in an RR scenario

In this scenario, you can create Loopback1 interfaces on egress router 1 and egress router 2, set the same IP address for the two interfaces, and use these interfaces to establish IBGP peer relationships with the RR. Because the next hops of the external network routes learned by all clients are the same, the clients can use these egress routers in load balancing mode through IGP recursion.

About This Topic
  • Author: Zhang Fan
  • Updated on: 2023-07-20
  • Views: 1694
  • Average rating:
Share link to