VIP Fast Failover
Overview
A VIP held by several machines is announced to your routers by each of them. When one holder loses power, its routers keep its path until their BGP session to it times out: the hold time (90 seconds) plus the graceful-restart time (60 seconds), so up to about 150 seconds. Traffic sent down that stale path is lost for that time.
Fast failover removes most of that wait. The surviving holders detect the death themselves, over the mesh, and make their own paths preferred at the routers, so the routers move the VIP's traffic to the survivors without waiting for the dead machine's session to expire.
Two measurements were taken on our test setups, each from the moment a holder was powered off.
Until a survivor moved the VIP into the takeover band (the survivor's own decision; the routers then still have to receive the update and change their forwarding, which comes on top of these times):
| Setup | Trials | Median | Slowest |
|---|---|---|---|
| 3 machines | 50 | 10.3 s | 12.3 s |
| 10 machines | 30 | 10.5 s | 13.8 s |
| 10 machines, every survivor under heavy CPU and I/O load | 30 | 10.9 s | 12.8 s |
Until the router's forwarding table changed, with BIRD and FRR routers and 3 holders:
| Setup | Trials | Median | Slowest | What the forwarding table showed |
|---|---|---|---|---|
| Both survivors with the same export prepend | 10 | 10.2–10.4 s | 11.1 s | both survivors |
| Survivors with different export prepends (0 and 1) | 10 | 10.3–10.5 s | 11.1 s | only the survivor with prepend 0, as intended |
On these setups the routers moved traffic within 11.1 seconds at worst with 3 holders, against about 150 seconds without fast failover; with 10 machines the survivors set the takeover band within 13.8 seconds at worst, before router propagation. These are measurements on test setups, not a promise for your network: how quickly the mesh notices a death grows with the number of machines in it and with load, and your routers' own update processing adds to it. The bounds the tests had to meet were 15 seconds for 3 machines and 33 seconds for 10, until the takeover band was set.
A restart that leaves the machine forwarding, such as an agent restart, does not trigger a takeover: in 50 graceful restarts and 20 crashes of the agent on a holder, no survivor took over. Those trials do not cover an agent upgrade that changes the kernel probe program; that case is untested here (see Not tested yet).
Fast failover applies only to VIPs that are eligible, and only within one mesh network. A VIP that is not eligible fails over the way it always has, when the routers' session to the dead holder expires.
How a survivor decides a holder is dead
Every survivor decides for itself. It treats a holder as dead only when all three of these are true:
- Gossip says the holder is down. The mesh's gossip protocol has marked the holder as failed. Gossip alone is not enough: an agent that restarts also drops out of gossip for a moment, while the machine keeps forwarding traffic.
- DURP says the holder is unreachable. DURP (the Durantic UDP Reachability Protocol) probes every peer directly over the underlay. When gossip reports a peer down, the survivor probes it faster, and the peer counts as failed once those probes go unanswered. DURP is answered by the machine's kernel, not by the agent, so a machine whose agent is restarting still answers. DURP alone is not enough either: a network fault between two live machines also makes probes fail.
- The evidence is recent. The survivor had a successful direct probe of the holder within the 150 seconds before gossip marked it down. A survivor that had not reached the holder directly in that time (because their direct path was already broken, or because it only reaches the holder through transit) has no evidence that the holder just died, and does not take over.
The 150 seconds is the longest a dead machine's path can stay at any router: the hold time plus the graceful-restart time.
When a survivor decides a holder is dead, it does two things:
- inside the mesh, it stops using the dead holder's routes wherever another path exists;
- for each eligible VIP the dead holder was announcing as healthy, it moves its own announcement into the takeover band (below), as long as it announces that VIP to a router itself and its own health check of the VIP passes.
It does this only if the dead holder had an external BGP peer. A holder that never announced to a router leaves no stale path behind, so there is nothing to take over.
Normal band and takeover band
An eligible VIP is always announced to routers in one of two bands:
| Band | What the router sees | When |
|---|---|---|
| Normal | The mesh's AS number prepended K extra times, and ORIGIN incomplete (?) |
Steady state |
| Takeover | No extra prepends, and ORIGIN IGP (i) |
While this machine takes the VIP over for a dead holder |
A path in the takeover band is never longer than one in the normal band, and wins a tie on ORIGIN, so routers prefer the survivors in the takeover band over every holder still in the normal band, including the dead holder's stale path. Survivors with the same export prepend and MED announce identical takeover paths, so a router spreads the traffic across all of them.
The takeover band ends 150 seconds after gossip marked the holder down. By then every router has dropped the dead holder's path, every survivor is back in the normal band, and routers spread traffic over all the survivors again. The band also ends early if the VIP becomes ineligible, the survivor stops announcing it, or the survivor's own health check of it fails.
A holder that comes back before the 150 seconds are up does not end the band: a router may still hold its old path. It rejoins in the normal band and gets no router traffic for that VIP until the band ends.
Eligible VIPs carry the K prepends and ORIGIN incomplete all the time, not just during a failover. Keep that in mind when you read your routers' tables.
What you configure
Fabric depth (d)
Set the fabric depth vip_fabric_depth (d) for your account: the largest difference in AS-path length that your
routing fabric can add between two holders of the same VIP, by the time their paths meet at the router that chooses
between them. It ranges from 0 to 8 and defaults to 0.
- Holders that all peer with the same routers, or with routers that compare their paths directly:
d = 0. - Holders behind different routers whose paths cross extra tiers before they meet: raise d to cover the extra AS hops one path picks up over the other.
Read and set it on the account configuration endpoint:
# read d and the warnings
curl -sH "Authorization: Bearer $DURANTIC_TOKEN" \
https://$CP/api/config/account
# set d
curl -sX PATCH -H "Authorization: Bearer $DURANTIC_TOKEN" -H 'Content-Type: application/json' \
-d '{"vip_fabric_depth": 2}' \
https://$CP/api/config/account
Changing d updates the BGP configuration of every machine in the account.
The prepend count (K)
You do not set K. The control plane derives it as
K = d + P
where P is the largest AS-path prepend that any enabled accept rule adds in your account's advanced-mode route policy sets, used as a machine's export policy or on an enabled external BGP peer's export policy. The control plane updates K for every machine whenever a policy change moves P. Because K always covers your largest export prepend, a takeover path can never be longer than a normal one.
A large prepend in any export policy therefore lengthens the normal-band path of every eligible VIP in the account.
Fabric depth warnings
GET /api/config/account also returns vip_fabric_depth_warnings: a check of d against the routers your machines
actually report. For every eligible VIP and every pair of its holders that have external BGP peers, the control
plane compares the routers (AS number and BGP identifier) each holder has an established session with. Each entry
names the VIP, the two machines, the router and a kind:
kind |
Meaning | What to do |
|---|---|---|
disjoint |
A router of one holder is not a router of the other, and is in a different AS. Their paths meet only further up the fabric. needed_depth gives the d the pair needs (2). |
Raise vip_fabric_depth to at least needed_depth, or more if your fabric is deeper. |
shared_asn |
A router of one holder is not a router of the other, but both are in the same AS, as with an MLAG pair. | Advisory: make sure the two routers exchange the VIP, with an iBGP link between them or allowas-in. |
unverified |
One of the two holders reports no established external session, so the pair could not be checked. | Check that holder's BGP sessions. |
The check only warns: nothing is refused, since sessions come up after the configuration is served. needed_depth
is a lower bound, as the reports cannot tell a two-tier fabric from a deeper one. An empty list means no problem was
found.
Eligibility
A VIP is eligible for fast failover when:
- it has a health check: only health-checked VIPs have their health shared between holders, and a survivor takes over only VIPs the dead holder was announcing as healthy;
- all its holders that are in a mesh are in one mesh network: survivors in another mesh cannot see the holder's death.
Every VIP returned by the VIP API (/api/connectivity/vips/) carries takeover_eligible and, when it is false,
takeover_ineligible_reason:
{
"name": "k8s-api-vip",
"takeover_eligible": false,
"takeover_ineligible_reason": "holders in meshes edge-a, edge-b"
}
| Reason | Fix |
|---|---|
no health check |
Add a health check to the VIP. |
no holder in a mesh |
Assign the VIP to machines that are in a mesh network. |
holders in meshes A, B |
Keep all of the VIP's holders in one mesh, or accept the slower failover. |
On each machine, the agent's metrics durantic_vip_takeover_active{vip_id} (1 while the machine holds the VIP in the
takeover band) and durantic_vip_takeover_total{reason} (bands set, extended and cleared, by reason) show takeovers
as they happen; see Monitoring & Metrics for enabling the metrics endpoint. The agent also logs each
takeover at Info as vip takeover set, vip takeover extended and vip takeover clear.
Router requirements
The routers that peer with your machines choose between the bands, so they must:
- honour AS-path length and ORIGIN in best-path selection: do not configure them to ignore AS-path length;
- not set a per-neighbour LOCAL_PREF or weight for VIP routes, which would outrank the bands;
- not dampen route flaps on VIP prefixes;
- allow at least 2 equal-cost paths (
maximum-paths≥ 2 or the equivalent) to spread traffic over the survivors, as for any anycast VIP.
Fast failover was tested against BIRD and FRR.
Anything else that announces the same VIP prefix without the bands is preferred over every banded holder in steady state, because its path is shorter: for example a non-Durantic backup announcing the same prefix, or a holder on an agent too old to band.
Upgrading
Upgrade the agents first, then the control plane. An agent that receives no eligibility for a VIP treats it as not eligible and announces it as before, so new agents run unchanged against an older control plane. Once the control plane is upgraded, it marks eligible VIPs and serves K and d to every machine.
Upgrade every holder of a VIP before upgrading the control plane: a holder still on an older agent announces the VIP without the K prepends, so routers prefer it over the upgraded holders.
Limits
- 63 health-checked VIPs per machine. Holders share VIP health through gossip, which carries at most 63 health-checked VIPs per machine. The API refuses a change that would give a machine more than 63.
- Cross-mesh VIPs fail over in about 150 seconds. A VIP whose holders are in more than one mesh is not eligible: it fails over when the routers' session to the dead holder expires.
- A link fault just before a restart. If a survivor's direct path to a holder starts failing less than 150 seconds before that holder's agent restarts, that survivor can take over even though the holder is alive. The false takeover lasts at most 150 seconds.
- Recently restarted survivors. For 15 seconds after its agent restarts, a machine keeps the peers it starts out assuming healthy from going to unreachable, until a probe to that peer succeeds. During that time it does not take over from those peers.
- No direct path, no takeover. A survivor that reaches the dead holder only through transit, or whose direct path to it had been down for more than 150 seconds, does not take over. Other survivors still do.
- A path added after the death. A direct path to the holder that appears after gossip marked it down keeps that survivor from concluding the holder is unreachable, so that survivor does not take over.
- A survivor that misses the death. A survivor that never learns of the death stays in the normal band, so the routers send traffic to the other survivors only, unevenly, for up to 150 seconds.
- An early return gets no traffic. A holder that comes back within the 150 seconds gets no router traffic for the VIP until the band ends.
- A second death during a takeover. If a survivor in the takeover band dies too, its takeover path stays at the routers until their session to it expires, and a share of the traffic goes to it meanwhile.
- An agent restart ends its bands. A survivor whose agent restarts during a takeover returns to the normal band.
- Uplink failures are out of scope. If a holder loses only its link to the router while the mesh stays up, the router's own session timeout handles it.
Not tested yet
These cases have not been tested, and are not covered by the numbers above:
- meshes larger than 10 machines, including the probe load at 30 machines;
- a dead holder that cold-boots and returns while the takeover band is still running;
- an agent crash on the holder the routers currently prefer, observed at the routers;
- an agent upgrade that changes the kernel probe program: the restart figures above do not include it, and the failover test that ran it could not show it would have caught a fault there. The probe program's own answering across such an upgrade has a separate test.
Related
- VIPs: creating VIPs and their health checks
- Load Balancing: BGP, route policy sets and export prepends
- Mesh Networking: gossip, DURP and transit