learninfra · Linux · Networking · Kubernetes · System Design · AI Infrastructure · Exam blueprints · Drills

Anycast & GeoDNS

One shop, many points of presence: answer each user with the nearest server, and move them when one dies.

An interactive Networking lesson: 19 steps, about 32 minutes, on a live simulation in your browser.

shop.example runs on a single server, web, in a single data centre. On a quiet afternoon that is fine. On the evening of a sale the shop slows down, then stops answering, and every user on earth shares the same outage.

One machine can only do so much, and one data centre is one flood, one cut cable, one bad deploy away from silence. The fix is not a bigger machine. It is more machines, in more places: points of presence close to the users.

What you will learn

  1. One shop, one server

    • One shop, one address
    • One road into town
  2. GeoDNS: one name, many answers

    • One name, many answers: GeoDNS is one name with many answers: the server picks which address to hand out based on where the asker seems to be.
    • Drill: ask the source
    • Move your region: A DNS change is live on the authority at once, and invisible everywhere else until each cached copy's TTL runs out.
  3. The TTL sets the speed

    • Five minutes later: The TTL on the old record is the worst case for a move: until it passes, some users get the old address and some the new.
    • Traffic follows the answer: GeoDNS steers traffic without touching a packet: whoever answers the lookup decides where the connection goes.
    • The TTL is the dial: A short TTL buys fast moves and pays in query load. A long TTL buys quiet name servers and pays in slow moves.
  4. Anycast: one address, many places

    • One address, everywhere: Anycast is one address announced from many places: each user is routed to the nearest announcer, and nobody picks a server.
    • Catchment: who goes where: A catchment is the set of users one PoP serves. Moves, failures and new PoPs redraw it; with GeoDNS you redraw it by editing answers.
    • Whose location decides?: GeoDNS answers for the address it sees. Without EDNS client subnet, that address is the resolver's, not the user's.
  5. When a point of presence dies

    • Maintenance over: move back
    • Break it: a PoP goes dark
    • Routing moves, DNS waits: The DNS TTL is the failover speed limit: no GeoDNS move helps anyone until their cached answer expires.
    • The catchment moves east: A GeoDNS failover is a catchment moving by edited answers. An anycast failover is the same catchment moving inside routing.
    • Break it: the authority is down
    • Drill: trace without names
  6. Recap & playground

    • Cheat sheet
    • Playground