Content Delivery Network (CDN): Overview and Use Cases
By Oleksandr Andrushchenko — Published on
A Content Delivery Network (CDN) is a distributed network of servers that cache and deliver content closer to users. Instead of serving every request from a single origin server, a CDN uses geographically distributed edge locations to reduce latency and improve performance.
When a user requests content, the CDN routes the request to the nearest edge server. If the content is already cached, it is returned immediately. Otherwise, the CDN fetches it from the origin server, caches it, and serves it to the user.
- Origin server – the primary source of content
- Edge locations – distributed servers closer to users
- Caching – storing content temporarily for faster delivery
How CDN Works
CDNs improve performance by minimizing the physical distance between users and the content they request. This reduces network latency and decreases load on the origin infrastructure.
- User sends a request for content (e.g., image, HTML, API response)
- Request is routed to the nearest edge location
- If content is cached (cache hit), it is returned immediately
- If not (cache miss), CDN fetches it from origin
- Content is cached for future requests
This model allows repeated requests to be served faster while reducing the number of direct calls to the origin server.
CDN vs Hosting
A CDN does not replace hosting. Instead, it acts as a performance layer on top of hosting. The origin server still stores and generates content, while the CDN distributes it efficiently.
| Aspect | Hosting (Origin) | CDN |
|---|---|---|
| Role | Stores and generates content | Caches and distributes content |
| Location | Centralized | Globally distributed |
| Latency | Higher (distance-based) | Lower (served from nearest edge) |
| Scalability | Limited by server capacity | Highly scalable |
When CDN Is Useful
CDNs are most useful in systems where performance, scalability, and global access are important. They are especially effective for content that can be cached and reused across many users.
- Static websites – faster delivery of HTML, CSS, and JavaScript
- Media delivery – images, videos, and large files
- Global applications – reduce latency for international users
- High-traffic systems – absorb traffic spikes and reduce backend load
- APIs – cache frequently requested responses
In general, the more frequently content is reused, the more benefit a CDN provides.
Benefits of Using CDN
Using a CDN improves both system performance and operational efficiency by offloading work from the origin infrastructure.
- Reduced latency – content is served closer to users
- Scalability – handles large traffic volumes automatically
- Origin offloading – fewer requests reach backend systems
- High availability – distributed infrastructure improves reliability
- Cost efficiency – reduces compute and bandwidth usage on origin
CDN in System Design
In system design, a CDN acts as a caching and distribution layer placed between users and backend services. It is commonly used to improve performance and protect backend systems from high traffic.
- Frontend layer – serve static assets (images, JS, CSS)
- API layer – cache GET responses to reduce backend load
- Media layer – distribute large files efficiently
CDNs are often combined with object storage and load balancers to build scalable and fault-tolerant architectures.
Example: CDN Setup with AWS CloudFront
Consider a blog website hosted on AWS where static content (HTML, CSS, JavaScript, and images) is stored in object storage. A CDN such as CloudFront is placed in front of the origin to cache and deliver content globally, reducing latency and backend load.
The following example shows a simplified CloudFormation configuration that defines a CloudFront distribution with an object storage origin:
Resources:
BlogCDN:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
# Enable the CloudFront distribution
Enabled: true
Origins:
- Id: BlogS3Origin
# Origin domain pointing to S3 bucket hosting static assets
DomainName: my-blog-bucket.s3.amazonaws.com
S3OriginConfig: {} # Required for S3 origin configuration
DefaultCacheBehavior:
# Connect this cache behavior to the defined origin
TargetOriginId: BlogS3Origin
# Force HTTPS for all viewer requests
ViewerProtocolPolicy: redirect-to-https
# Allowed HTTP methods from viewer to CDN
AllowedMethods:
- GET
- HEAD
# Methods that CloudFront caches
CachedMethods:
- GET
- HEAD
ForwardedValues:
# Do not forward query strings to origin (improves cache efficiency)
QueryString: false
ViewerCertificate:
# Use default CloudFront SSL certificate
CloudFrontDefaultCertificate: true
In this setup, CloudFront caches static content at edge locations and serves users from the nearest location. The origin (S3) is only accessed on cache misses, which improves performance and reduces load on the storage layer.
Full production blog implementation can be found here: Blog platform DynamoDB single-table design (case study).
Summary
A CDN is a critical component in modern distributed systems, designed to improve performance by caching and delivering content closer to users.
- CDN = performance and scalability layer
- Works together with hosting, not instead of it
- Essential for global and high-traffic applications
Core idea: move content closer to users to reduce latency and load on backend systems.
Comments (0)