CSS Prepare

optional · CSS study notes

Content Distribution Networks

🧭

On this page — click any heading below to jump straight to it. ⬅️ Back to P-II.II. Computer Communications & Networks


OSI Layer: Application Layer (L5–L7)

Definition

A Content Distribution/Delivery Network (CDN) is a geographically distributed system of proxy/edge servers that cache and deliver content (web pages, video, images, software updates) from a server location physically or topologically closer to the end user, reducing latency and offloading the origin server.

How a CDN Works — Request-Routing Methods (Classification)

The core technical challenge a CDN solves is directing each user's request to the best nearby edge server; this is done via one of several classified mechanisms:

  • DNS-based redirection — the CDN's DNS server resolves a domain name to the IP address of the geographically/topologically nearest edge server, based on the requester's location (inferred from their resolver's IP); the most common approach (used by Akamai, Cloudflare).
  • Anycast routing — the same IP address is advertised from multiple edge locations simultaneously; standard Internet routing (BGP) automatically delivers each user's packets to the topologically nearest location advertising that address, with no explicit redirection needed.
  • HTTP redirection — the origin server or a load-balancer explicitly redirects (HTTP 3xx) a client's request to a specific edge server's URL.
  • URL rewriting / embedded links — a web page's content itself is authored so that large embedded objects (images, video, scripts) point directly to CDN-hosted URLs, letting the CDN handle those specific requests transparently.

Types of Content Delivered / CDN Architectures

  • Static content CDN — caches unchanging assets (images, CSS, JavaScript, downloadable files); the simplest and original CDN use case.
  • Video/streaming CDN — specialised for large, continuous media delivery, often using adaptive bitrate streaming and dedicated video-optimised edge infrastructure (e.g., for Netflix, YouTube-scale delivery).
  • Dynamic content acceleration — some modern CDNs also optimise delivery of personalised/dynamic content (content that cannot simply be cached) using route optimisation and connection reuse between edge and origin, even though the content itself isn't cached.
  • Telco/ISP-embedded caches — CDN edge nodes physically hosted inside a national ISP's own network (rather than only at Internet exchange points), placing content as close as possible to end users — highly relevant to countries dependent on limited international bandwidth.

Benefits

  • Reduced latency — content served from a nearby edge node rather than a potentially distant origin server.
  • Reduced origin load — the origin server handles far fewer direct requests, since most are satisfied from cache.
  • Improved reliability/redundancy — if one edge node fails, requests are automatically routed to another.
  • Resilience against traffic spikes and DDoS attacks — load is absorbed and distributed across many geographically dispersed nodes rather than overwhelming a single origin.

Comparison: Request-Routing Methods

MethodMechanismGranularity of Control
DNS-basedResolves domain to nearest edge IPPer-resolver (coarse, resolver-location based)
AnycastBGP routes to topologically nearest advertiserNetwork-determined (very coarse but automatic)
HTTP redirectionExplicit 3xx redirect to a specific edge URLFine-grained, per-request
URL rewritingPage authored with CDN-hosted object URLsFine-grained, per-object

CSS Exam Angle

  • Tie this to Pakistan's Internet experience specifically — local telco-embedded CDN caches (e.g., Google/Facebook/Akamai caches hosted within Pakistani ISP networks) significantly reduce dependency on expensive international bandwidth and improve speed for end users — a strong applied point for the exam.
  • Naming the request-routing classification (DNS-based, anycast, HTTP redirection, URL rewriting) shows depth well beyond a surface "CDN caches content near users" definition.
  • Explicitly mention DDoS resilience as a security-adjacent benefit, not just a performance one — examiners sometimes frame CDN questions from a security angle.

Example

When streaming a YouTube video in Pakistan, the video is very likely served from a Google CDN cache node physically located within the country (peered directly with local ISPs) rather than from servers abroad, dramatically reducing both latency and the load on Pakistan's international bandwidth links.

Likely Questions

  1. What is a Content Distribution Network (CDN)? Explain its working and benefits.
  2. Classify the request-routing methods a CDN can use to direct users to the nearest edge server.
  3. How does a CDN improve resilience against DDoS attacks?
  4. Why are locally-embedded ISP caches particularly significant for a country like Pakistan?

📜 Past-Paper Questions & Structured Answers

Questions are paraphrased; answer focus is suggested guidance, not an official marking scheme.

2024 · Paper-II · Q4(b) · 7 marks

Question (paraphrased): Explain how overlays and CDNs improve performance/scalability, with a numerical example.

Answer focus: Define both, explain mechanisms, calculate a benefit and acknowledge a trade-off.

Overlay: a logical network whose nodes and links operate over an underlying IP network. It can add content placement, routing or resilience without changing every underlying router. A security overlay such as a VPN is one example, but the question concerns performance and scalability more broadly.

CDN mechanism: geographically distributed edge servers cache content. Request routing selects a suitable healthy edge using location, reachability and load; it need not be the geographically nearest server. A hit is served locally; a miss fetches from the origin, subject to cache policy.

Benefits: shorter network paths reduce latency, replication spreads demand, and cache hits reduce origin and transit traffic. Multiple locations improve resilience. Costs include cache consistency, storage and routing complexity; dynamic/private content may not be cacheable.

Numerical illustration — explicitly assumed values: suppose 90% of requests hit an edge in 20 ms and 10% take 200 ms through the origin. Mean response time =0.9×20+0.1×200 = 38 ms, versus 200 ms without caching: 81% lower mean delay, about 5.26 times faster. If demand is 1,000 requests/s, origin demand falls to 100 requests/s, a 90% reduction. Assume the same content, adequate edge capacity and miss delay including origin retrieval.

Conclusion: performance improves through locality; scalability improves through replication and load distribution. A CDN helps absorb traffic spikes, but does not guarantee immunity to every DDoS attack.

Related numerical: the separate 2025 six-mark institutional web-cache calculation is fully worked in HTTP (HyperText Transfer Protocol). Use its given values when answering that paper, not the hypothetical values above.