How CDN Works: Boosting Web Performance with Edge Caching
This article explains what a Content Delivery Network (CDN) is, how it optimizes web traffic by caching resources at edge nodes, compares traditional and CDN-enabled access flows, and clarifies related terms such as CNAME records, DNS, and origin host configuration.
What Is a CDN
CDN stands for Content Delivery Network. It adds a caching layer to the Internet, placing website content on edge nodes closest to users, reducing latency and bandwidth strain. By serving cached resources from nearby nodes, CDNs alleviate network congestion, lessen origin server load, and improve user experience.
CDN Nodes
Key Optimization Benefits of CDNs
Solve the "first mile" problem for origin servers
Mitigate bottlenecks between different ISPs
Reduce provincial outbound bandwidth pressure
Alleviate backbone network load
Optimize distribution of popular online content
CDN Working Principle
Traditional Access Process
When a user accesses a site without CDN caching:
1. User enters the domain name; the OS queries Local DNS for the IP. 2. Local DNS queries the root DNS for the authoritative server (assuming cache expiration). 3. Root DNS returns the authoritative DNS record. 4. Local DNS queries the authoritative DNS for the IP. 5. Authoritative DNS responds with the IP. 6. Local DNS returns the IP to the client. 7. Client contacts the origin server. 8. Origin server responds with the requested content.
CDN Access Process
With CDN caching enabled, the flow changes to:
1. User enters the domain; OS queries Local DNS for the IP. 2. Local DNS queries the root DNS for the authoritative server (cache may be expired). 3. Root DNS returns the authoritative DNS record. 4. Local DNS obtains the record and queries the authoritative DNS for the IP. 5. Authoritative DNS returns a CNAME record. 6. Local DNS contacts the intelligent routing DNS for the optimal CDN node IP. 7. Intelligent routing DNS selects the best node based on algorithms and capacity, returning its IP. 8. Local DNS returns this IP to the client. 9. Client contacts the CDN node. 10. CDN node serves cached content or fetches from the origin if not cached.
By using DNS redirection to guide users to the nearest cache server, CDN acceleration becomes transparent to end users.
Components of a CDN Network
Each CDN node acts like a web server placed near users. Through DNS takeover, requests are transparently directed to the nearest node, which responds like the origin server but with lower latency.
Intelligent Routing DNS (e.g., F5's 3DNS) It decides which node IP to return based on predefined policies, node health, and capacity, ensuring users are routed to the closest available node.
Cache Services Load balancers (e.g., LVS, F5 BIG-IP), content cache servers (e.g., Squid), and shared storage.
Glossary
CNAME Record
A CNAME (Canonical Name) maps one domain name to another. When a DNS query encounters a CNAME, it follows the alias to the target name until an A or PTR record is found. Example:
To let documents.example.com serve the same content as docs.example.com, add a CNAME record pointing documents.example.com to docs.example.com. All requests to the former will be redirected to the latter.
CNAME Domain (CDN‑provided)
After adding an accelerated domain in a CDN console, the provider gives a CNAME domain. You must create a CNAME record in your DNS that points your own accelerated domain to this CDN‑provided CNAME, enabling traffic to be routed to CDN nodes.
DNS
The Domain Name System translates human‑readable domain names into IP addresses. Common DNS providers include Alibaba Cloud DNS, DNSPod, Route53, Cloudflare, etc.
Origin Host
The origin host determines which site on the origin server the CDN should request when fetching uncached content.
Protocol Back‑Origin
The protocol used for back‑origin requests matches the client’s request protocol (HTTP or HTTPS), ensuring consistency when the CDN retrieves resources from the origin.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
