Skip to content
Author: ytianle

We want to deliver content of WWW to users with high availability and performance.

CDN⚓︎

Introduction⚓︎

CDN (Content Delivery Network) is a distributed network of proxy servers and corresponding data centers 1. CDNs are designed to improve the performance, reliability, and scalability of web applications by caching and serving content from servers that are geographically closer to the end-users.

alt text

How CDN works⚓︎

Everytime a user requests the same content, the CDN server then checks if it has a cached copy of the requested content. If it does, it serves the content directly to the user. If not, it retrieves the content from the origin server, caches it, and then serves it to the user.

alt text

CDN Pull (Cache Content from Origin Server)⚓︎

When the first user requests content from a web application that uses a CDN, the request is routed to the nearest CDN server based on the user's geographic location.

There is TTL (Time to Live) associated with each cached content, which determines how long the content will be stored on the CDN server before it is considered stale and needs to be refreshed from the origin server.

CDN Push (Preload Content to CDN Servers)⚓︎

In some cases, web application owners may choose to preload or "push" content to CDN servers in advance. This is often done for static content that is expected to be frequently accessed by users.

CDN Concerns⚓︎

While CDNs offer significant benefits in terms of performance and scalability, there are also some concerns to consider:

  • Cost: Using a CDN can incur additional costs, especially for high traffic websites or applications with large amounts of data.
  • Outdated Content: When update before TTL, the cached content may become outdated if the origin server updates the content but the CDN has not yet refreshed its cache.
  • Security: While CDNs can enhance security by providing DDoS protection and secure connections, they can also introduce new attack vectors if not properly configured.
  • Complexity: Integrating a CDN into an existing web application can add complexity to the architecture and may require additional configuration and maintenance (update URL to point to CDN).

References:⚓︎


  1. (Wikipedia: Content delivery network)[https://en.wikipedia.org/wiki/Content_delivery_network#:~:text=A%20content%20delivery%20network%20(CDN)%20or%20content%20distribution%20network%20is%20a%20geographically%20distributed%20network%20of%20proxy%20servers%20and%20corresponding%20data%20centers.]