Content Delivery Network - CDN
Last Updated :
17 Oct, 2025
CDN stands for Content Delivery Network. It is a network that helps to speed up web page loading for web users. It is spread all over the world as usage of the internet is everywhere. It is basically a distributed system of servers that stores the data by the use of Amazon Web Services or Google Cloud storage and it serves that data to the user via the nearest server so that the loading or buffering of web pages is low.
Working of CDN
A CDN operates through three key components:
- Origin Server: The main server that stores and maintains the updated version of the websiteâs data.
- Edge Servers: Located in multiple geographic regions, they temporarily cache content from the origin and deliver it to users from the nearest location, ensuring faster load times.
- DNS Server: Translates domain names into IP addresses and directs user requests to the appropriate server.
When a user requests content, the DNS routes the request to the nearest edge server. If the cached copy is unavailable, the edge server fetches it from the origin, ensuring seamless content delivery.
Importance of CDN
A Content Delivery Network (CDN) improves web performance by reducing latency and speeding up content delivery. By distributing data across global servers, it ensures faster load times, lowers bandwidth usage, maintains high availability, and strengthens security against threats like DDoS attacks.
- Fast Delivery: Edge servers worldwide minimize delays and handle heavy traffic efficiently.
- Lower Bandwidth Costs: Caching reduces data transfer and network consumption.
- High Availability: Keeps content updated and accessible at all times.
- Enhanced Security: Protects websites from cyber threats and attacks.
Example of CDN
This example shows how to use a CDN to include jQuery in a webpage. It uses jQuery to add a paragraph to the page when it loads.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<title>
The jQuery CDN Example
</title>
<script crossorigin="anonymous" integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" referrerpolicy="no-referrer" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function () {
$("body").append("<p>Hello geeks from GeeksForGeeks!!</p>");
});
</script>
</head>
<body>
<h1>
Hello
</h1>
</body>
</html>
Output:
OutputExplanation:
- Load jQuery via CDN: The
<script> tag fetches the jQuery library from Cloudflareâs CDN, ensuring faster loading and reduced server load. - Wait for Page to Load:
$(document).ready() ensures the JavaScript runs only after the webpage is fully loaded. - Add Content Dynamically:
$("body").append("<p>âĶ</p>") inserts a paragraph into the webpageâs body.
How does a CDN improve website performance?
-
-
-
By caching static content close to the end-user
-
Explanation:
CDNs replicate content across servers globally, reducing the physical distance between users and servers, which speeds up access.
What is the primary purpose of a Content Delivery Network (CDN)?
-
To store all website data on a single server
-
To speed up content delivery by using globally distributed servers
-
To replace DNS servers entirely
-
To host websites without using cloud storage
Explanation:
CDNs reduce loading time by serving content from the server closest to the user.
Which component of a CDN stores the updated/actual version of website data?
Explanation:
The origin server contains the original source content that edge servers replicate.
When a user requests a webpage, what does the CDN typically do first?
-
Fetches data directly from the origin server
-
Routes the request to the nearest edge server via DNS
-
-
Compresses the content on the fly
Explanation:
DNS redirects the user to the geographically nearest edge server to reduce latency.
Quiz Completed Successfully
Your Score : 2/4
Accuracy : 0%
Login to View Explanation
1/4
1/4
< Previous
Next >
Explore
AI for Coding
AI for Image and Video
Research Using AI
MS Office Suite
Operating Systems & Tools
Management Tools