
Durgesh Tiwari
Author
Modern websites and applications are used by people from different countries and regions. If every user request is sent to a single origin server, users who are far from that server may experience higher latency and slower page loading.
To solve this problem, modern applications use a Content Delivery Network (CDN). A CDN stores copies of website content on servers located in different geographical locations. Instead of serving content from the origin server every time, it delivers content from the nearest edge server, reducing latency, improving website speed, and lowering the load on the origin server.
Today, popular platforms such as Netflix, Amazon, YouTube, Facebook, Instagram, and Spotify use CDNs to deliver content quickly and provide a better experience for users around the world.
A Content Delivery Network (CDN) is a network of geographically distributed servers that stores and delivers website content from locations closer to users.
Instead of sending every request to the origin server, a CDN stores stores cached copies of frequently accessed content copies of frequently accessed content on multiple edge servers. When a user requests a file, the CDN delivers it from the nearest edge server whenever possible.
In simple words, a CDN delivers website content from the server closest to the user, reducing latency and improving website speed.
Suppose a website's origin server is located in London, and a user visits the website from Delhi.
Without a CDN: The request travels to the origin server in London, increasing loading time.
With a CDN: The request is served by the nearest edge server in or near India, so the website loads much faster.
As websites grow, they start receiving visitors from different cities and countries. If every request is served from a single origin server, response time increases and the server has to handle more traffic.
A CDN solves this problem by delivering content from the nearest edge server, reducing latency and improving website performance.
A CDN helps to:
Reduce website loading time.
Minimize network latency.
Improve user experience.
Reduce traffic on the origin server.
Handle high traffic efficiently.
Improve website availability.
Deliver content faster to users worldwide.
For websites with a global audience, a CDN is an important part of modern system design.
A Content Delivery Network (CDN) acts as an intermediary between users and the origin server.
When a user requests a web page or static content, DNS routes the request to the nearest CDN edge server. The edge server checks whether the requested content is already available in its cache.
Cache Hit: If the content is available, the CDN serves it directly from the cache.
Cache Miss: If the content is not available, the CDN fetches it from the origin server, stores a copy in its cache, and then delivers it to the user.
After the content is cached, future requests are served directly from the CDN instead of the origin server. This reduces latency, improves website speed, and lowers the load on the origin server.
User
│
▼
DNS
│
▼
Nearest CDN Edge Server
│ │
Cache Hit Cache Miss
│ │
▼ ▼
Cached Content Origin Server
│ │
└──────► User ◄──────┘
An Edge Server is a server located close to users that stores cached copies of website content.
Instead of fetching content from the origin server every time, the CDN delivers it from the nearest edge server whenever possible. This reduces the distance data travels, resulting in lower latency and faster page loading.
Edge servers mainly store static content such as:
Images
CSS files
JavaScript files
Videos
Fonts
PDF documents
Example
Suppose a website's origin server is located in the United States, but it has users in India, Germany, Australia, and Japan.
The CDN stores copies of the website's static content on edge servers across these regions. When a user visits the website, the content is delivered from the nearest edge server instead of the origin server, making the website load much faster.
An Edge Network is a group of edge servers distributed across different locations around the world.
These edge servers work together to deliver content from the server nearest to the user, reducing latency and improving website performance.
Example
Suppose a CDN provider has edge servers in India, Singapore, Germany, Australia, and the United States.
When users from different countries visit the same website, the CDN automatically serves content from the nearest edge server instead of the origin server. This helps websites load faster while reducing the load on the origin server.
CDN Caching is the process of storing frequently accessed content on edge servers.
When users request the same content, the CDN serves it directly from the cache instead of fetching it from the origin server. This reduces server load and improves website performance.
Content commonly cached by a CDN includes:
Images
CSS files
JavaScript files
Fonts
Videos
Audio files
PDF documents
Static HTML pages
A user requests a file.
The CDN checks whether the file is available on the nearest edge server.
Cache Hit: The file is served directly from the cache.
Cache Miss: The CDN fetches the file from the origin server and stores a copy on the edge server.
Future requests for the same file are served directly from the cache.
Example
Suppose an e-commerce website has a product image viewed by thousands of users every day.
Instead of fetching the image from the origin server for every request, the CDN stores it on edge servers. Users receive the image from the nearest edge server, making the website load faster and reducing the load on the origin server.
Whenever a user requests content, the CDN checks whether the requested file is already available in its cache.
Based on the result, the request is classified as either a Cache Hit or a Cache Miss.
A Cache Hit occurs when the requested content is already available on the CDN edge server.
The CDN serves the content directly from the cache without contacting the origin server.
Example
Suppose a user requests a company logo that is already stored on the nearest edge server. The CDN delivers the image immediately from its cache, resulting in faster page loading.
Advantages of a Cache Hit
Faster content delivery.
Lower latency.
Reduced load on the origin server.
Better user experience.
A Cache Miss occurs when the requested content is not available on the CDN edge server.
The CDN fetches the content from the origin server, stores a copy on the edge server, and then delivers it to the user.
Example
Suppose a website uploads a new banner image. When the first user requests it, the CDN fetches the image from the origin server because it is not yet cached. After delivering the image, the CDN stores a copy on the edge server so future requests can be served directly from the cache.
A CDN mainly caches static content because it does not change frequently and can be served quickly from edge servers.
Common types of content cached by a CDN include:
Images (JPG, PNG, SVG, WebP)
CSS files
JavaScript files
Fonts
Videos
Audio files
PDF documents
Static HTML pages
Software downloads
Web applications mainly serve two types of content: Static Content and Dynamic Content.
Understanding the difference helps determine which content can be cached by a CDN.
Static Content | Dynamic Content |
|---|---|
Rarely changes. | Changes based on the user or request. |
Can be cached easily. | Usually not cached by default. |
Same for all users. | Different for different users. |
Served from CDN edge servers. | Generated by the application server. |
Examples: Images, CSS, JavaScript, Videos, Fonts | Examples: User Dashboard, Shopping Cart, Payment Page, Bank Balance |
In most cases, a CDN caches static content, while dynamic content is generated in real time by the application.

CDN Cache Invalidation is the process of removing or updating outdated content stored on CDN edge servers.
When content changes on the origin server, the CDN must serve the latest version instead of an outdated cached copy. Cache invalidation ensures that old files are removed or refreshed so users always receive updated content.
Without cache invalidation, users may see outdated images, web pages, CSS files, or JavaScript files.
Every cached file has a Time-to-Live (TTL) value that determines how long it remains in the cache.
When the TTL expires, the CDN fetches the latest version from the origin server and updates its cache.
Website administrators can manually remove cached files from the CDN whenever content is updated.
The next request fetches the latest version from the origin server and stores it in the cache.
Cache Versioning updates the file name or URL whenever the content changes.
For example:
style.css?v=1
style.css?v=2Since the URL changes, the CDN treats it as a new file and caches the updated version.

Until now, we have seen that a CDN mainly stores and delivers cached content from edge servers. However, modern applications often need more than just content delivery. Sometimes, they need to process requests closer to users instead of sending every request to the origin server.
This is where Edge Computing comes in.
Edge Computing is a computing model in which code or application logic runs on edge servers located close to users. Instead of processing every request on the origin server, some tasks are executed at the network edge, reducing latency and improving response time.
In simple words, Edge Computing allows applications to process requests closer to users instead of relying only on the origin server.
User authentication
URL redirects
Personalizing web pages
API request processing
Security checks
Image optimization
Example
Suppose a user from India visits a global e-commerce website.
Instead of sending the request to the origin server in the United States, an edge server in India checks the user's location, redirects them to the Indian website, and optimizes images before delivering the page.
Since these tasks are performed on the nearest edge server, the website responds faster and reduces the load on the origin server.
Many cloud providers offer Content Delivery Network (CDN) services through global edge networks. These services help websites deliver content faster, reduce latency, and improve availability.
Some of the most popular CDN providers are:
Cloudflare: One of the most popular CDN providers, Cloudflare offers content delivery, caching, DDoS protection, SSL support, and website security.
Amazon CloudFront: Amazon's CDN service that delivers content through AWS's global edge network and integrates seamlessly with other AWS services.
Google Cloud CDN: Uses Google's global network to deliver content with low latency and high performance for applications hosted on Google Cloud Platform (GCP).
Microsoft Azure CDN: Delivers website content through Microsoft's global network while providing caching, security, and performance optimization.
Akamai: One of the world's largest CDN providers, widely used by enterprise websites, streaming platforms, and large online businesses for fast and reliable content delivery.
Using a Content Delivery Network (CDN) offers several benefits for modern web applications.
Reduces website loading time.
Decreases network latency.
Improves user experience.
Reduces load on the origin server.
Handles high traffic efficiently.
Improves website availability.
Delivers content faster to users worldwide.
Enhances security with features like DDoS protection and SSL.
Improves scalability during traffic spikes.
Although a Content Delivery Network (CDN) offers many benefits, it also has some challenges.
Additional cost.
Cache management can be complex.
Dynamic content is more difficult to cache.
Incorrect cache settings may serve outdated content.
Performance depends on the CDN's edge server coverage.
Initial configuration requires careful planning.
Although a CDN and a Web Server work together, they serve different purposes.
CDN | Web Server |
|---|---|
Stores cached copies of content. | Stores the original website or application files. |
Delivers content from nearby edge servers. | Processes application requests and generates responses. |
Mainly serves static content. | Serves both static and dynamic content. |
Reduces latency by serving nearby users. | Handles business logic and data processing. |
Reduces load on the origin server. | Acts as the primary source of website content. |
A CDN does not replace a Web Server. Instead, it works with the origin server to deliver content faster, reduce server load, and improve the overall user experience.

A Content Delivery Network (CDN) is commonly used by websites and applications that serve users worldwide.
Some common use cases include:
E-commerce websites
Video streaming platforms
News and media websites
Online learning platforms
Gaming applications
Social media platforms
Software download websites
Corporate websites with global users
A CDN helps these applications deliver content faster, reduce latency, and handle large volumes of user traffic efficiently.
Netflix uses a Content Delivery Network (CDN) to stream movies and TV shows to millions of users worldwide. Instead of serving videos from a single data centre, Netflix stores copies of popular content on edge servers located in different regions.
When a user in India watches a movie, the video is streamed from the nearest edge server instead of a distant origin server. This reduces buffering, improves streaming quality, and provides a smooth viewing experience.
Similarly, companies such as Amazon, YouTube, Facebook, Instagram, and Spotify use CDNs to deliver images, videos, and other static content quickly to users around the world.
A Content Delivery Network (CDN) delivers content from the server closest to the user.
CDNs reduce latency, improve website speed, and reduce the load on the origin server.
Edge Servers and Edge Networks help deliver content faster across different regions.
CDN Caching, Cache Hit, Cache Miss, and Cache Invalidation improve performance and keep content up to date.
Popular CDN providers include Cloudflare, Amazon CloudFront, Google Cloud CDN, Microsoft Azure CDN, and Akamai.
CDNs are widely used to build fast, scalable, secure, and highly available web applications.