How CDN Accelerates Web Delivery: Principles, Caching, and Refresh Strategies
This article explains what a Content Delivery Network (CDN) is, how caching works at both the browser and edge‑node levels, the step‑by‑step request flow, common drawbacks, caching strategies, and how developers can refresh CDN caches to keep content up‑to‑date.
What Is a CDN?
A Content Delivery Network (CDN) is a distributed network of edge servers deployed across various regions on top of the underlying internet. It offloads traffic from the origin server, reduces network congestion, and speeds up content delivery by serving users from the nearest edge node.
The concept can be likened to the evolution of train ticket sales in China: originally, tickets could only be bought at the station, requiring long travel to purchase them. The introduction of local ticket agencies made buying tickets much faster and more convenient, just as CDN edge nodes bring content closer to users.
What Is Caching?
Caching is a classic space‑for‑time trade‑off: by storing copies of data in extra storage, access speed improves. Browsers cache images and files locally, so subsequent visits avoid re‑downloading everything, reducing bandwidth and load time.
When a CDN sits between the browser and the origin, the request flow changes: the browser first checks its local cache; if expired, it queries a nearby CDN edge node. The edge node checks its own cache; if fresh, it serves the content directly. Otherwise, it fetches the latest data from the origin (back‑to‑origin request) and caches it for future requests.
Typical CDN topology includes the client, the CDN edge node, and the origin server, illustrating the two‑stage caching process (browser cache → edge cache → origin).
How CDN Works (Request Flow)
Assume the accelerated domain is www.a.com. When a user in Beijing requests a resource, the following steps occur:
The user’s local DNS (LDNS) resolves www.a.com. If the IP address is cached, it is returned immediately; otherwise, the query proceeds to the authoritative DNS.
The authoritative DNS returns a CNAME record pointing to www.a.tbcdn.com, which resolves to an IP address.
The request is routed to Alibaba Cloud’s DNS scheduling system, which selects the optimal edge node IP.
The LDNS receives the selected IP and returns it to the user.
The user sends an HTTP request to that IP.
If the edge node already has the requested resource cached, it returns the data directly (cache hit).
If the resource is not cached, the edge node forwards a back‑to‑origin request to the origin server, caches the response according to the configured policy, and then serves the user (cache miss).
CDN Caching
Edge nodes implement their own caching mechanisms similar to browsers. Cached data reduces latency and offloads the origin, but stale caches can cause outdated content to be served even after the origin has been updated.
CDN Caching Drawbacks
While CDN caching improves performance, it can lead to inconsistencies when a website updates. If the edge node’s cache is not refreshed, users may still see old content despite clearing their browser cache.
CDN Caching Strategies
Most providers follow HTTP standards, using the Cache‑Control: max‑age response header to set the TTL (time‑to‑live) for edge caches. When a client requests data, the edge node checks expiration: if the cached copy is still valid, it returns it; otherwise, it fetches fresh data from the origin, updates its cache, and serves the client.
Providers often allow fine‑grained control based on file extensions, directories, or custom rules, enabling developers to balance freshness against load and latency. Short TTLs increase back‑origin traffic, while long TTLs risk serving outdated content.
Refreshing CDN Cache
Developers can purge or refresh edge caches via the CDN provider’s API or management console. This forces the edge nodes to discard stale copies, ensuring that subsequent requests retrieve the latest version 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 Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
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.
