CDN
TrafficContent Delivery Network that caches and serves content from edge locations close to users, reducing latency and origin load.
Overview
A Content Delivery Network (CDN) is a geographically distributed network of proxy servers and data centers that cache content closer to end users. In Vetora's simulator, the CDN component models edge caching behavior, cache hit rates, and the interaction between edge nodes and your origin servers. CDNs are one of the most impactful components you can add to a system design — they reduce latency by 50–90% for cacheable content and offload 60–95% of traffic from your origin infrastructure.
CDN caching operates on a pull-through model: the first request for a resource is a cache miss that fetches from the origin, and subsequent requests are served from the edge cache until the time-to-live (TTL) expires. Vetora models this warm-up phase and lets you see how cache hit rates evolve over time. You can observe the cold-start penalty when a new edge PoP (Point of Presence) comes online and how cache warming strategies reduce that penalty.
Cache invalidation is famously one of the two hard problems in computer science. CDNs offer several strategies: TTL-based expiration is the simplest — content expires after a fixed duration. Purge-based invalidation lets you explicitly remove content when it changes. Stale-while-revalidate serves potentially stale content while fetching a fresh copy in the background, trading consistency for availability. Origin shielding adds a mid-tier cache between edge PoPs and your origin, reducing origin load when many edge nodes simultaneously re-fetch expired content.
In system design interviews, demonstrating CDN knowledge means understanding which content types benefit from caching (static assets, API responses with stable data, rendered HTML pages) versus which should bypass the cache (user-specific data, real-time pricing, authentication endpoints). Vetora's simulator lets you configure cache rules per content type and observe the resulting traffic split between edge-served and origin-served requests.
Modern CDNs also provide DDoS protection, TLS termination, HTTP/2 and HTTP/3 support, edge compute capabilities (like Cloudflare Workers or CloudFront Functions), and WebSocket proxying. These features make the CDN more than a cache — it becomes the front door of your entire infrastructure.
When to Use
Recommended
- +Serving static assets (images, CSS, JS bundles) to a global user base — reduces latency from 200ms to under 30ms
- +Offloading read-heavy API responses that change infrequently (product catalogs, public profiles, configuration data)
- +Protecting origin servers from traffic spikes — CDN absorbs the burst while origin handles a fraction of the load
- +Providing DDoS protection and TLS termination at the edge before traffic reaches your infrastructure
- +Reducing bandwidth costs — CDN egress is typically cheaper than origin egress at scale
Not Recommended
- -Highly personalized content that differs per user — cache hit rates will be near zero, adding latency instead of reducing it
- -Real-time data that must always reflect the latest state (stock prices, live auction bids)
- -Write-heavy endpoints — CDNs are optimized for reads and add overhead to non-cacheable requests
- -Internal service-to-service communication within a single data center — a CDN adds unnecessary network hops
Key Parameters in Vetora
Real-World Examples
Amazon CloudFront
AWS's CDN with 400+ edge locations globally, integrated with S3, ALB, and Lambda@Edge for edge compute. Powers Netflix, Slack, and thousands of production systems.
Cloudflare
Global CDN with 300+ data centers, offering DDoS protection, Workers (edge compute), and zero-trust security. Serves over 20% of all web traffic.
Akamai
Pioneer CDN provider with the largest network (4,000+ PoPs). Handles 30% of global web traffic and serves major enterprises including financial institutions.
Fastly
Edge cloud platform known for instant purge capability (150ms global purge), VCL-based configuration, and Compute@Edge using WebAssembly for edge logic.
Frequently Asked Questions
What is a CDN and why is it important in system design?
A Content Delivery Network (CDN) is a distributed network of servers that caches content at edge locations close to users. It is important in system design because it reduces latency by 50–90% for cacheable content, offloads 60–95% of traffic from origin servers, provides DDoS protection, and reduces bandwidth costs. In system design interviews, adding a CDN demonstrates understanding of geographic latency optimization and capacity planning.
How does CDN cache invalidation work?
CDN cache invalidation uses three main strategies: TTL-based expiration automatically removes content after a configured duration (e.g., 5 minutes for API data, 24 hours for images). Purge-based invalidation lets you explicitly delete cached objects when source data changes. Stale-while-revalidate serves expired content while fetching fresh data in the background, prioritizing availability over consistency. Modern CDNs like Fastly can purge globally in under 150ms.
What is origin shielding in a CDN?
Origin shielding adds a mid-tier cache layer between edge PoPs and your origin server. Without shielding, if 100 edge nodes each have a cache miss simultaneously, your origin receives 100 requests. With origin shielding, all edge misses route through a single shield node that fetches once from origin and distributes to all edges. This dramatically reduces origin load during cache expiration events and is essential for systems with many global PoPs.
When should you NOT use a CDN?
Avoid CDN caching for highly personalized content (user dashboards, customized feeds) where each user sees different data, resulting in near-zero cache hit rates. Real-time data like live stock prices or auction bids should bypass the CDN. Write-heavy endpoints gain no benefit since CDNs optimize for reads. Internal service-to-service calls within a data center should use direct communication rather than routing through external CDN infrastructure.
How do you calculate CDN cache hit rate?
CDN cache hit rate is calculated as (cache hits) / (total requests) × 100%. For static assets with long TTLs, expect 90–99% hit rates. For dynamic API responses, 40–70% is typical. Key factors include TTL duration (longer = higher hit rates but more stale data), content cardinality (fewer unique URLs = higher hits), traffic volume per PoP (more requests = warmer cache), and cache key design (avoid including unnecessary query parameters that fragment the cache).
Related Components
Traffic source representing end users or external systems that generate requests to your architectur...
Distributes incoming traffic across multiple server instances using algorithms like round-robin, lea...
Scalable blob storage for unstructured data like images, videos, documents, and backups with lifecyc...
Centralized entry point that handles authentication, rate limiting, request routing, and protocol tr...
Try CDN in the Simulator
Build architectures with CDN and 13 other component types. Run discrete event simulations and get AI-powered feedback.
Open Playground