What is Load Balancing?
Load Balancing is a feature whereby your router has more than one WAN (Internet) connection, for example two ADSL lines and distributes your Internet traffic across both of them. Load balancing can operate over any number of WAN feeds and they can be of different types - for example an ADSL connection and a fibre connection.
The purpose of load balancing is either:
- To try to achieve a uniform traffic balance - spreading connections equally across your WAN connections, thus making best use of your available bandwidth or
- To distribute traffic according to a set of rules defining which WAN feed should be used for a given data or connection type.
The type of WAN connections supported (ADSL, VDSL, Ethernet, 3G/4G etc.) will depend on the specific router model. For instance the Vigor 2860 series has an ADSL2+/VDSL2 modem for WAN1 and an Ethernet WAN interface for WAN2, it also has two USB ports for 3G/4G modems and can load balance all four connections potentially.
Simple Load Balancing
In the simplest setup, your router will send outgoing data requests over all available connections. For example, if you have two WAN connections (Internet feeds); one PC requesting a web page might be sent over WAN1 and then a second PC's request would then be sent over WAN2. In this way, if, say each connection has a download rate of 12Mb/s, both PCs would be able to download at 12Mb/s at once - your data is balanced across the two connections. Note that those 'two PCs' might actually be just one PC as each can make several connections (sessions) to the Internet at once.
In the example earlier, we cited two 12Mb/s connections but, in reality, you might have WAN feeds, each of different capacity (bandwidth).
For example you might have one 60Mb/s VDSL connection, a 20Mb/s ADSL connection and a 5Mb/s 3G Cellular connection. In that scenario, your router would typically apply a distribution ratio so that three times as many connections (sessions) are sent over the VDSL connection compared to the ADSL, as it has three times the capacity.
Similarly, the 3G connection would have an even smaller proportion.
Limitations to even distribution of connections
We've spoken about the router allocating sessions (or connection requests) that you get a good spread of connections over all of your WAN connections however, the number of sessions actually has little relationship to the actual volume of data that might be sent over that session. For example, if 10 users request web pages, of, say, 120KB each and two other users starts FTP file downloads of 26MB each, you have 12 sessions in total and the router will allocate 6 sessions to each WAN connection (WAN1 & WAN2) in the order in which they start.
In this way, you may happen to end up with both of the large downloads on the same WAN feed (WAN1) with four of the web sessions, and the other 6 web sessions on the other WAN connection (WAN2). The 6 sessions on WAN2 will complete quickly, and then WAN2 is idle - its bandwidth wasted whilst WAN1 is still busy with those large downloads.
Ideally, the two file downloads would have been allocated to different WAN connections, along with 5 of the web sessions each however, your router doesn't know in advance the volume of data that each of those 12 sessions will generate - it has to allocate each session to one of the WAN connections, and there it will stay.
In reality, routers don't apply such simple decisions; the decision making facility is a bit smarter than just round-robin allocation, but you know your data better than the router does, and that's where rules become useful.
Load Balancing According to Rules
Instead of letting your router entirely decide how to distribute connection requests, your load balancing can instead operate according to rules, or a routing policy. There are several different criteria you can apply as rules for the router to follow but the most common are selecting the WAN connection based on the source or destination, or the traffic type.
If traffic matches a load balancing rule it can then be routed via a chosen interface. The interface could be a specific WAN feed (WAN1, WAN2 etc) or a VPN tunnel and is applied depending on the Source IP / Destination IP / Destination Port that the traffic uses.
Metrics and Priority
For granular control over the routing decision that is taken for specific traffic, metrics can be used to decide which routing entry is chosen where multiple rules might match. Pre-set metric values are used for different classes of routing entries (For example Static Routes, VPN Routes, Default Routes etc.) and manually added Policy Rules have a configurable priority metric which allows these rules to over-ride the router's routing table if required. A metric system provides flexibility and gives predictable control.
Failover is very closely related to load-balancing in that it makes use of two or more WAN connections, but in this case the additional WAN connections would be used as 'emergency' connections in place of the primary connection when that fails. For example, if your main connection is a VDSL line, and your line breaks, a router can automatically switch over to (say) a 4G/LTE wireless connection or another DSL line etc.
Failover is an inherent part of load-balancing, in that two WAN connections can be load-balanced, but in the case of one connection going down, all traffic is routed via the remaining connection. Once the other WAN connection resumes, normal load balancing can resume.
The Failover behaviour can also be controlled using the Failback options in Route Policy rules, which make it possible to specify whether or not the router would force traffic back onto the main primary connection when it resumes service.