Day 49: Cloud pattern: CDN (Content Delivery Network)

02 Aug 2017

The role of a CDN is to:

CDNs are cache servers distributed around the globe as close as possible to the end-user.

CDNs deliver cachable content. Then it won’t improve performance of request that must reach the server, with side effect, such as POST/PUT/PATCH/DELETE/… HTTP requests.

DNS anycast is responsible for routing the request to the closest CDN point of presence.

In case of DDoS attack, CDN are a good way to protect servers (it depends of your infrastructure actually).

CDNs can be used:

Storage bucket

Cache is flushed by pushing a new stateful content, right into the bucket.

Reverse proxy

A larger endpoint can be routed to this kind of CDN. Cached answers are provided by the CDN from the second request. Every other calls are proxied to the origin server.

Depending on the CDN provider, caching can be based on layer 7 rules, such as: HTTP verbs, response status code, path, query-string or headers (ETag, Cache-Control, Origin…).

Flush can be manual (in a web admin console) or automatic (etag, max-age, no-cache, ttl…)

Famous CDN providers: