Sub topic 14
Application-aware routing and path selection
This chapter assumes you know the basics of routing and the SD-WAN overlay model from the previous chapters: each site has an edge device, and the edges build tunnels across several transports such as MPLS, broadband, and LTE. Here you will see how the edge chooses which tunnel carries each kind of traffic.
Why destination-based routing is not enough
A traditional router picks a next hop by looking at the destination address and the routing table. It does not care whether the packet belongs to a voice call or a software download. It also does not notice that the chosen link has become slow, as long as the link is still up.
That causes two common problems on a WAN with several transports:
- A link can be up but degraded. A broadband circuit with 5% loss still keeps its routing adjacency, so the router keeps using it for voice.
- A cheap link sits idle. A backup circuit carries nothing until the primary fails, so you pay for capacity you never use.
Application-aware routing (AAR) fixes both. The edge measures the quality of every tunnel, identifies the application, and picks a path that meets that application's needs.
The four building blocks
Application-aware routing works through four steps that run continuously on each edge device.
- Probe. The edge sends small test packets through each tunnel to every remote edge, usually every second or so.
- Measure. From the replies it calculates latency, loss, and jitter for each path. Latency is the one-way or round-trip delay. Loss is the percentage of probes or packets that never arrive. Jitter is the variation in delay between packets.
- Classify. The edge identifies the application. It can use a port or address match, or deep packet inspection (DPI), which looks at packet contents and signatures to recognize an application such as a video conferencing service.
- Decide. The edge compares each path's measurements with the SLA class attached to the application, and picks a path from those that qualify.
SLA classes
An SLA class is a set of thresholds. A path "meets" the class only if every metric is at or below its limit. A typical voice-class SLA looks like this:
| Metric | Voice class | Bulk-transfer class |
|---|---|---|
| Latency | 150 ms | 400 ms |
| Loss | 1% | 5% |
| Jitter | 30 ms | not checked |
Voice needs low jitter because a receiver plays audio at a steady rate. Bulk transfers such as backups tolerate delay and some loss because TCP retransmits. The thresholds you choose should come from the application vendor's guidance and from your own baseline measurements, not from defaults alone.
Policy: matching, preference, and fallback
A policy has three parts: what traffic it matches, which transports are preferred, and what happens when none qualifies.
- Match. Application name, DSCP value, source or destination prefix, or a combination.
- Preference. An ordered list of transports, or a list of colors or labels that the controller maps to transports. A cost-driven policy might list broadband first and MPLS second. A quality-driven policy might list MPLS first.
- Fallback. What the edge does if no path meets the SLA. Common choices are to use the least-bad path, to use a designated transport such as MPLS regardless of its metrics, or to drop the traffic.
The controller defines and distributes the policy. The edges enforce it locally, using their own measurements. This split matters: the decision runs at line rate on the edge, and a controller outage does not stop path selection. Edges keep using the last policy they received.
A worked example
The Python function below models the decision step. It returns the first transport, in order of preference, whose measured latency, loss, and jitter are all within the SLA.
# Simplified model of SD-WAN application-aware path selection.
paths = {
"mpls": {"latency_ms": 35, "loss_pct": 0.1, "jitter_ms": 5},
"broadband": {"latency_ms": 60, "loss_pct": 0.8, "jitter_ms": 20},
"lte": {"latency_ms": 90, "loss_pct": 1.5, "jitter_ms": 35},
}
sla = {"latency_ms": 150, "loss_pct": 1.0, "jitter_ms": 30} # voice-class SLA
preference = ["broadband", "mpls", "lte"] # cheapest first
def meets_sla(metrics, sla):
return all(metrics[k] <= sla[k] for k in sla)
def choose_path(paths, sla, preference):
for name in preference:
if meets_sla(paths[name], sla):
return name
return None # no path qualifies; a real policy would fall back
print(choose_path(paths, sla, preference)) # broadbandBroadband is first in the preference list, and its numbers (60 ms, 0.8%, 20 ms) are inside the voice SLA, so it wins even though MPLS is better on every metric. Suppose broadband loss rises to 2.4%. The same call now fails the check for broadband, the loop moves on, and the function returns mpls. When the broadband loss recovers, voice moves back. In a real device that return trip is where the next section matters.
Failure modes and gotchas
Flapping. If a path hovers near a threshold, flows could move back and forth every few seconds. Edges reduce this with hysteresis, which means requiring a path to stay good (or bad) for several measurement intervals before switching. Many implementations also use a short averaging window. Longer windows give stability but react slowly to real failures, so you trade stability against reaction time.
Probe overhead. Probes use bandwidth. On a site with 100 tunnels and a fast interval, probing is not negligible on a slow LTE link, and on metered links it costs money. Tune the interval per transport.
Measuring the wrong thing. Probes measure the tunnel path, not your application. A probe may be treated differently from real traffic by a congested queue or a rate limiter. Marking probes with the same DSCP class as the traffic they represent gives a fairer reading.
Asymmetry. Forward and return paths can differ. Each edge chooses its own outbound path, so a call can leave over broadband and return over MPLS. That works, but jitter and delay then differ per direction, and stateful firewalls in the middle may object. Check that your policy is deliberately symmetric where it needs to be.
Per-flow versus per-packet. Most designs steer per flow, so all packets of one call stay on one path and arrive in order. Per-packet load balancing uses capacity better but can reorder packets, which hurts voice and some TCP flows.
Classification errors. DPI relies on signatures. Encrypted traffic and applications that share infrastructure can be misidentified, and the first packets of a flow may be sent before classification completes. Such early packets follow a default policy. Test your key applications, not just the policy syntax.
Rerouting does not create capacity. If all paths are congested, selection only chooses the least bad one. Application-aware routing works alongside QoS queuing on the edge, not in place of it.
Comparison with MPLS-style approaches
MPLS handles quality inside the provider network using QoS classes and traffic engineering. You mark traffic with DSCP, the provider honors those classes, and you trust the provider's SLA. SD-WAN works from the edge: it assumes nothing about the underlay and measures it. That gives visibility across providers, including ordinary internet service, but it can only choose among paths you already have.
Exercise
A site has MPLS (35 ms, 0.1% loss, 5 ms jitter) and broadband (60 ms, 2.4% loss, 20 ms jitter). The voice SLA allows 150 ms latency, 1% loss, and 30 ms jitter. The policy prefers broadband first, then MPLS. Which path carries voice, and what mechanism prevents voice from bouncing back to broadband immediately when broadband loss briefly drops to 0.9%?
Show answer
Voice uses MPLS, because broadband loss of 2.4% exceeds the 1% limit. To avoid flapping, the edge applies hysteresis: broadband must stay within the SLA for several consecutive measurement intervals (or an averaged window) before the flow is moved back.
Exercise
Why does a controller outage not stop application-aware path selection?
Show answer
The controller only defines and distributes the policy. Each edge measures its tunnels and makes the decision locally, and it keeps using the last policy it received.