System Design AI

CDNs: Follow-Up Questions Interviewers Ask (And How to Answer)

Interviewers bring up CDNs because they sit at the intersection of performance, cost, and reliability. A candidate who can name a CDN has shown basic awareness, but the real test is whether they understand the knobs you can turn and the consequences of each turn.

Probing further lets the interviewer see if you can reason about real-world traffic patterns, edge-case failures, and the business impact of design decisions. The answers you give should be concrete, measurable, and show that you can trade one metric against another.

Why interviewers dig deeper

CDNs are more than a "static-file cache" box. They involve DNS routing, edge placement, cache-control policies, and integration with origin services. A senior-level candidate must demonstrate a holistic view: how a CDN fits into the overall architecture, what it protects, and where its limits lie. A staff-level candidate goes a step further, discussing operational monitoring, edge-case failure handling, and future-proofing the design for evolving traffic.

Follow-up questions

1. How does a CDN reduce latency for a global audience?

I would say a CDN places edge nodes in many geographic regions, often within 100 ms of most users. When a request arrives, DNS resolves to the nearest edge based on latency measurements. For example, serving a 500 KB image from an edge in Europe to a user in Berlin typically takes under 30 ms, versus roughly 150 ms from a US-based origin. This reduction comes from shorter network hops and TCP warm-up at the edge.

2. What cache-control headers do you use to balance freshness and hit-rate?

I rely on Cache-Control: max-age=300, stale-while-revalidate=60. This tells the edge to serve the cached copy for five minutes, then, if a request arrives after expiration, it can still serve the stale copy for another minute while it fetches a fresh version. In practice, on a news site with 10 % of articles updated hourly, this policy yields a hit-rate of roughly 85 % while keeping stale content under a minute.

3. How do you handle cache invalidation for rapidly changing content?

For high-change items, I use versioned URLs—embedding a hash or timestamp in the filename, like style.v20231101.css. When the content updates, the URL changes, forcing the edge to fetch a fresh copy. If versioning isn’t possible, I trigger an explicit purge via the CDN’s API, targeting the affected paths. In a recent rollout, purging 2 000 URLs took about 45 seconds, well within the SLA.

4. What is the cost impact of using a CDN versus serving directly from the origin?

CDN costs are typically a combination of data transfer (e.g., $0.08 per GB out) and request pricing (e.g., $0.0075 per 10 000 requests). For a site that serves 5 TB per month with a 70 % cache hit-rate, the origin traffic drops to 1.5 TB, saving roughly $0.12 × 3.5 TB = $420 in origin bandwidth. The CDN itself might cost about $0.08 × 5 TB = $400, so the bandwidth bill comes out roughly even, and the real gain is the performance benefit.

5. How do you choose the number and location of edge nodes?

I start by looking at the user distribution heat map. If 60 % of traffic comes from North America, 25 % from Europe, and the rest from Asia, I ensure the CDN provider has at least two edge locations in each of those regions. For finer granularity, I examine latency logs; if users in Brazil experience >150 ms, I add a South-America edge. The goal is to keep the 95th-percentile latency under 100 ms.

6. What happens if an edge node fails or loses connectivity to the origin?

When an edge node cannot reach the origin, the CDN falls back to serving stale content if stale-if-error is set, or it returns a 502 or 504 error. Most providers have health-checks that automatically route traffic away from unhealthy nodes. In practice, a multi-region CDN can tolerate the loss of an entire edge region without impacting user experience, as traffic reroutes to the next-closest edge.

7. How do you monitor CDN performance and detect anomalies?

I instrument both edge-side and origin-side metrics. From the CDN I collect cache hit-rate, latency per region, and error rates. From the origin I watch request volume and response times. I set alerts for sudden drops in hit-rate (e.g., >10 % decrease) or spikes in 5xx errors. Using a dashboard, I can correlate a latency increase in Europe with a recent deployment that changed cache headers.

8. Can you describe a strategy for serving personalized content through a CDN?

For personalization, I keep the base page cached and fetch user-specific data via API calls from the client. If personalization must be done at the edge, I use edge functions that can rewrite the response body (e.g., Cloudflare Workers) to read cookies and inject small fragments. In a recent e-commerce case, the edge function added a personalized banner in under 5 ms, preserving the overall page load time.

9. How would you future-proof the CDN design for a 10× traffic growth?

I would adopt a multi-CDN strategy, routing traffic through two providers using DNS-based load balancing. This spreads load and mitigates provider-specific outages. I’d also design the origin to be stateless and horizontally scalable, so the CDN can keep high cache hit-rates while the backend scales. Finally, I’d automate cache-policy reviews and purge scripts to handle the larger volume without manual intervention.

What separates a senior answer from a staff answer?

A senior-level response explains the "what" and "why"—the trade-offs, typical numbers, and clear operational implications. A staff-level answer adds the "how" at scale: monitoring pipelines, multi-CDN redundancy, edge-function security considerations, and proactive capacity planning. Staff candidates also discuss organizational impact, such as cost-center alignment and cross-team coordination for rollout.

How to practice this

  1. Review the worked CDN design in the System Design AI library to see a complete walkthrough.
  2. Sketch your own CDN architecture on the practice canvas, labeling edge nodes, cache policies, and monitoring hooks.
  3. Simulate an interview: answer the nine questions aloud, keeping each response to about a minute.

Questions people ask

What is the main benefit of using a CDN?

A CDN reduces latency by serving content from edge locations close to users, which cuts round-trip time and offloads traffic from the origin.

How does cache invalidation work?

You can invalidate by versioning URLs, issuing purge API calls, or using short max-age values combined with stale-while-revalidate to keep content fresh.

When should I consider a multi-CDN approach?

When you expect rapid traffic growth, need high availability across regions, or want to mitigate a single provider’s outage risk.

What metrics matter most for CDN health?

Cache hit-rate, regional latency percentiles, error rates, and origin-fetch latency are key indicators of CDN performance.