When designing a 20 Tbps edge ingress, pair XDP Maglev + DSR to offload L4 egress with BFD/BGP withdrawal and QUIC CID tunneling for PoP failover.
TL;DR30-second simplified summary▾
XDP Maglev handles ~1.5 Tbps ingress with O(1) consistent hashing, Envoy replies directly via DSR to offload 20 Tbps egress, and BFD + QUIC CIDs enable <3s PoP failover.
/24 Anycast routing and why Maglev's 65,537-slot lookup table prevents ECMP reshuffling.R & E · Requirements, Asymmetric Bandwidth & DSR Math.
HTTP traffic is heavily asymmetric: a 500-byte GET request triggers a 50 KB JSON or media response (a 100:1 egress-to-ingress ratio, ~10:1–20:1 on average across mixed API traffic).
Illustrative Sizing: Across 30 PoPs, 20 Tbps egress averages ~667 Gbps/PoP (bursting to 2 Tbps/PoP), while ingress is only ~1–2 Tbps globally (~33–67 Gbps/PoP). With DSR, L4 balancers only handle 67 Gbps ingress per PoP (2x 100GbE NICs per L4 box, 2–4 boxes/PoP) instead of 2 Tbps egress!
Symmetric L4 Proxy vs. Direct Server Return (DSR)
- L4 NICs carry 20 Tbps egress
- 10x more L4 servers needed
- Double sk_buff memory copies
- L4 only handles ~1.5 Tbps ingress
- Envoy replies directly to client
- 10+ Mpps/core in XDP
S · State & Conntrack Tables in eBPF Maps.
Software L4 balancers cannot acquire global mutexes at 10 Mpps; all state must live in lock-free per-CPU eBPF maps.
Each L4 node maintains: (1) maglev_table (BPF_MAP_TYPE_ARRAY, 65,537 entries -> Envoy VIP index); (2) conntrack_lru (BPF_MAP_TYPE_LRU_PERCPU_HASH, 4M entries keyed by 5-tuple -> {backend_ip, last_seen_ns}); (3) vip_backends (BPF_MAP_TYPE_ARRAY of healthy Envoy IPs + weights).
NIC RX -> Conntrack LRU -> Maglev Array -> IPIP/GRE Encap
H & A · Global Anycast + L4/L7 + DSR Packet Flow.
A user sends a packet to Anycast VIP 198.51.100.1. BGP routes it to the closest PoP's border routers, which ECMP-hash the 5-tuple to one of the PoP's Maglev L4 servers.
Maglev checks conntrack_lru (or maglev_table on SYN), wraps the packet in an IPIP/GRE header addressed to the chosen Envoy L7 node's unicast IP, and transmits it. Envoy decapsulates the packet—revealing the original (client_ip -> 198.51.100.1)—terminates TLS/HTTP, and sends the response straight out the PoP gateway with source IP 198.51.100.1.
Client -> Anycast Router -> Maglev L4 -> Envoy L7 -> Client (DSR)
D · Detailed Design: <3s PoP Drain & QUIC CID Migration.
If a PoP loses upstream transit or Envoy health checks drop below threshold, its BGP daemon (ExaBGP / BIRD / GoBGP) must withdraw the Anycast prefix fast.
With BFD (Bidirectional Forwarding Detection) + 500 ms local health probes, an unhealthy PoP withdraws its BGP announcement in <2 seconds. For active QUIC/HTTP3 connections, the 8-byte QUIC Connection ID encodes (pop_id, server_id): if BGP shifts a user to PoP 2 mid-stream, PoP 2 reads pop_id=1 from the CID and tunnels those packets over the private backbone to PoP 1.
Healthy -> Health Drop -> BGP Withdraw (<3s) -> Neighboring PoP
- Problem
- How to drain or fail over an Anycast PoP without dropping active sessions or blackholing traffic.
- Naive Solution
- Kill the BGP speaker process abruptly on maintenance or rely on 60s BGP hold timers.
- Why It Fails
- 60s hold timers blackhole traffic for a full minute; abrupt withdrawal resets every active TCP connection in flight.
- Alternatives
- Abrupt BGP kill vs. BFD + Graceful-Shutdown Community + QUIC CID Backbone Tunneling.
- Engineering Decision
- Use BFD (<2s hard-failure withdrawal), BGP
65535:0graceful drain for maintenance, and QUIC CID routing for mid-stream PoP shifts. - Trade-Offs
- Requires private inter-PoP backbone capacity for tunneled QUIC flows and strict uRPF/DSR router config.
During a PoP's peak 1.5 Tbps video-streaming burst, Envoy L7 proxies are healthy, but your Maglev L4 servers hit 100% NIC TX saturation. What architectural change removes the bottleneck?
E & D · Evaluation, Assumptions, Limitations & Glossary.
DSR requires L2/L3 adjacency (or IPIP/GRE support) between L4 balancers and L7 proxies and permissive uRPF on egress border routers.
Assumptions & Limitations: Bandwidth estimates assume 10:1–20:1 egress-to-ingress asymmetry across 30 PoPs, an owned ASN with /24 IPv4 / /48 IPv6 prefixes, and private backbone tunnels for QUIC CID migration. In public cloud VPCs where raw source-IP spoofing (DSR) is blocked by SDN hypervisors, you must use cloud-native GWLB (GENEVE) or symmetric L4 proxies.
Anycast BGP + XDP Maglev + Envoy DSR + QUIC CID Backbone
Practice: Make the trade-off yourself.
Why does Direct Server Return (DSR) dramatically reduce L4 load balancer hardware requirements at a 20 Tbps edge?