CSE Roadmap

Common tier · about 4 hours · 8 parts

Part 4 of 8 · 2 min read

Routing

DNS, anycast and health.

The user's device must reach a good edge: near, healthy and not overloaded.

DNS-based routing. The CDN's DNS server answers a name lookup with the address of a chosen edge. It picks by the location of the resolver (or by a client subnet hint), by measured network performance, and by load and health. Short DNS TTLs (for example 30 seconds) allow quick changes. A weakness: the DNS server sees the user's resolver, which may be far from the user.

Anycast. Many PoPs announce the same IP address to the internet. Network routing (BGP) sends each user to the topologically nearest PoP automatically. Failure of a PoP withdraws its announcement, and traffic moves to the next nearest. A weakness: network distance is not always the fastest or least loaded, and long connections can break if routes change mid-flow. Many CDNs combine both.

Health and load. Each PoP reports health and load to the control plane. When a PoP is overloaded or broken, DNS answers stop pointing to it, or its announcement is withdrawn. Overflow goes to the next nearest PoP.

Connection costs. A new HTTPS connection costs several round trips. The edge helps because the user-to-edge distance is short, and because the edge keeps long-lived warm connections to the origin. TLS certificates for each customer domain are managed by the control plane and distributed to all edges.

A worked example (made up). A user in Pune asks for img.example-cdn.com. The CDN's DNS sees a resolver in Pune and returns the address of the Mumbai PoP (8 ms away) rather than Singapore (60 ms). When Mumbai loses power, health checks fail, DNS stops returning it within 30 seconds, and Pune users go to Chennai.

Reaching the origin. The edge needs to know where the origin is for each customer domain. Keep that in configuration pushed from the control plane. Provide fallback origins, with a timeout and retry.

Check yourself: 1. How does DNS routing choose an edge? 2. What does anycast do when a PoP fails? 3. What is the weakness of DNS routing?