Load Balancing

Updated on Apr 17, 2024 by

What Is Load Balancing?

Load balancing is a technique used in computer networks and distributed systems to distribute incoming network traffic or workload evenly across multiple servers, resources, or network interfaces. The primary goal of load balancing is to optimize resource utilization, maximize throughput, minimize response time, and avoid overloading any single resource. By distributing workloads effectively, load balancing ensures that no single server or resource becomes overwhelmed, thereby enhancing system reliability, availability, and scalability. Load balancers typically monitor the health and performance of individual servers or resources and dynamically adjust traffic distribution based on factors such as server capacity, response time, and current network conditions.

Types of Load Balancing

Load balancing can be categorized into three types: route, tunnel, and trunk load balancing.

  • 1. Route load balancing

This type of load balancing distributes traffic across multiple forwarding paths to the same destination. It's important to note that load balancing is only performed among routes of the same routing protocol, as determining equal-cost routes across different protocols can be challenging.

  • 2. Tunnel load balancing

This type of load balancing,when applied within a VPN, distributes traffic across multiple tunnels originating from the same source PE and directed towards a common destination PE. MPLS VPNs offer various tunnel types, including:

- Label Switched Paths (LSPs): comprising LDP LSPs, BGP LSPs, and static LSPs.

- Constraint-based Routed Label Switched Paths (CR-LSPs): encompassing RSVP-TE CR-LSPs and static CR-LSPs. CR-LSPs adhere to specific constraints like bandwidth or path requirements, unlike conventional LSPs.

- Generic Routing Encapsulation (GRE) tunnels: GRE-encapsulated data packets traverse a public IP network transparently.

3. Trunk load balancing

This type of load balancing distributes traffic across multiple member links of a trunk, created by bundling physical interfaces with the same link layer protocol. It operates in two modes:

- Static LACP mode, where LACP identifies active and inactive links within a Link Aggregation Group (LAG). This mode, also known as the M:N mode, employs M active links and N backup links, enhancing link reliability and enabling load balancing among the active links.

- Manual load balancing mode, where interfaces are manually added to the trunk and traffic is evenly distributed or weighted among them. If an active link fails, traffic is automatically balanced among remaining active links.

Working Modes of Load Balancing

Load Balancing Modes

  • 1. Per-flow and per-packet load balancing

Per-flow load balancing categorizes packets into different flows based on rules like the IP 5-tuple (source and destination IP addresses, protocol number, source and destination port numbers). Packets within the same flow are sent over the same link. The following figure shows per-flow load balancing.

Per-flow load balancing

Per-packet load balancing distributes packets evenly across links based on their arrival sequence. This method is depicted in the figure. The following figure shows per-packet load balancing.

Per-packet load balancing

Per-packet load balancing achieves a more even distribution of packets compared to per-flow load balancing. The effectiveness of per-flow load balancing varies depending on the specific load balancing rules and the characteristics of service traffic.

  • 2. ECMP and UCMP

Equal-cost multi-path (ECMP) distributes traffic uniformly among equal-cost paths to the same destination, regardless of their bandwidth. The following figure shows ECMP networking.

ECMP networking

Unequal-cost multi-path (UCMP) allocates traffic among equal-cost paths based on bandwidth ratios. The following figure shows UCMP networking.

UCMP networking

Load Balancing Algorithm

In per-packet load balancing mode, a device increments a counter each time it receives a packet and selects an outbound interface based on the counter's value.

In per-flow load balancing mode, a device utilizes a hash algorithm to convert a binary value into a smaller binary value, known as the hash value. This hash value is then mapped to an outbound interface, and packets are transmitted through this interface.

Traffic is hashed according to various characteristics, termed hash factors, including the Ethernet frame header, IP header, TCP/UDP header, MPLS header, and L2TP packets. The effectiveness of load balancing depends on how hashable these factors are, and in complex network traffic scenarios, achieving optimal load balancing may be challenging.

Typical Application Scenarios of Load Balancing

  • 1. Link Expansion Scenario:

In this scenario, R1 and R2 are linked by four 10G connections. As service demands grow, a 40G link is added, requiring load balancing across the existing 10G links and the new 40G link.

Link expansion scenario

To achieve this, UCMP can be globally enabled on each device and specifically configured on the four 10G interfaces and the 40G interface.

If a device lacks UCMP support, configuring four IP addresses on the 40G interface allows each 10G interface to have a distinct next hop, while the 40G interface has four next hops, facilitating IP load balancing.

  • 2. BGP Load Balancing in an RR Scenario:

In this setup, a route reflector (RR) is utilized within AS 100. The RR selects optimal routes from egress routers and disseminates them to clients with equal-cost uplinks to the egress routers.

BGP load balancing in an RR scenario

However, due to the nature of BGP route selection, load balancing cannot be directly implemented.

To address this, Loopback1 interfaces are established on both egress routers with the same IP address. These interfaces are then used to establish IBGP peer relationships with the RR, enabling clients to employ load balancing between the egress routers through IGP recursion.

FS Same Day Shipping Ensures Your Business Success
Nov 20, 2023
FS Same Day Shipping Ensures Your Business Success
Related Topics