What are some of the techniques of network load balancing?
Load balancers improve the network’s performance. They do this by decreasing the burden and distributing traffic among multiple links for each network node during transmission. These load balancers only care about the network layer information of the packets being transmitted in either of the directions.
Note: Here, we will mainly talk about network load balancing.
In order to learn about application load balancers, read this Answer.
Explanation
Let’s understand the same concept with the help of an illustration below:
In the example above, there are multiple paths to serve the requests for the end-user. This prevents network congestion. If the path is unavailable for packet transmission due to any problem in the network, an alternative path can be followed.
Here are different types of network load balancing:
- Packet spraying
- Per-Flow load balancing
Packet spraying
The packet spraying load balancing type works almost like the round-robin load balancing technique. It sequentially utilizes all the available paths heading towards the packet destination. This evenly distributes the network traffic to all connected links.
For example, in the illustration above, we have two paths for each router to send packets. So, if a router is required to send three packets to the same destination, it will send the first packet over the first path. It will send the second packet over the second path and again use the first path to send the third packet.
We can see this in the slides below:
Disadvantages of packet spraying
In packet spraying, we may experience the unordered arrival of packets at the destination.
-
Packets experience unexpected delay or loss when transmitted to a link with poor transmission quality or high congestion.
-
Sometimes, packets vary in size and are transmitted to the same link. In such a case, the small packets will arrive at the destination before the large packets under the steady transmission rate.
Note: Packet spraying is not recommended for services sensitive to packet reorderings, such as voice and video calls.
Per-flow load balancing
The per-flow type of load balancing is widely used in networks. The packets are considered to be in the same flow if they match the following five attributes:
- Source IP address
- Destination IP address
- Protocol number
- Source port number
- Destination port number
This load balancer classifies packets into different flows using the hash of some or all the five values above.
Packets with the same hash value will be transmitted over the same link.
Let’s say a router has six packets P1, P2, P3, P4, P5, P6 to transmit to the destination. Packets in red belong to a different destination, and packets in green belong to a different one. Packets in green will be transmitted through the link in green, and packets in red will through the link in red.
We see this in the slides below:
Disadvantages of per-flow load balancing
Per-flow load balancing causes unequal utilization of paths. Let’s say there are two large flows, two small flows, and only two paths. Ideally, each path should have one large flow and one small flow. However, it is possible that the flow distribution is such that both the large flows map onto the same path. This would cause an inefficient sharing of resources.
Free Resources