How does a CDN get a user to the nearest edge location? Explain anycast and the role of DNS in this.
What they are really testing: Senior signal: do you understand how global traffic steering actually works (anycast routing and DNS geo-resolution), not just "a CDN caches content near users".
A real interview question
How does a CDN get a user to the nearest edge location? Explain anycast and the role of DNS in this.
What most people say
drag me
“A CDN stores copies of your content in different countries so users get it from a nearby server.”
It describes caching but not the steering mechanism. The question is how the user is actually routed to the nearest edge, which is anycast and DNS, and that is missing.
The follow-ups they ask next
What are the trade-offs of anycast versus DNS-based geo-routing for steering?
Anycast reacts instantly to BGP changes and needs no client DNS accuracy, but you have less fine-grained control and long-lived TCP sessions can rarely flip PoPs. DNS steering gives more control (geo, latency, weighting) but is limited by resolver location accuracy and DNS caching/TTL.
How does anycast help absorb a DDoS attack?
The same IP is served from many PoPs, so attack traffic is distributed across all of them by routing instead of concentrating on one location, raising the total capacity an attacker must overcome.
What the interviewer is listening for
- Explains anycast (one IP, many BGP announcements)
- Knows DNS-based geo steering
- Connects anycast to resilience/DDoS absorption
What sinks the answer
- Only "caches content nearby"
- No mechanism for how users are routed
- Unaware of anycast or BGP
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“A CDN [caches content at edge PoPs worldwide], and steers users two ways. DNS-based: [the CDN nameserver returns a nearby edge IP based on the resolver location]. Anycast: [the same IP is announced from many sites via BGP, so routing delivers to the nearest]. Anycast also gives [resilience, a failed PoP reroutes automatically, and DDoS absorption].”
Keep going with networking
Foundation
What is a VPC, and what is a subnet within it? Why split a network into subnets at all?
Foundation
What is the difference between TCP and UDP, and when would you choose each?
Foundation
What happens, step by step, when you type a URL into a browser and press enter?
Foundation
How does DNS resolution actually work, and what is the difference between an A record and a CNAME?
Foundation
What is the difference between IPv4 and IPv6, and why does IPv6 exist?
Junior
An EC2 instance in a private subnet needs to download OS updates from the internet. Walk me through how you make that work, and why.
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free