Caching at the Edge: CDNs for everyone

published on September 22, 2015

Drupal 8 has comprehensive knowledge about the cacheability of the things it renders. This opens new doors. Did you know Drupal 8 will be able to cache everything at the edge?

For sites with many mobile users (high latency due to network), global audiences (high latency due to distance) and performance-sensitive sites (e-commerce), Drupal 8 will be a huge leap forward.

We’ll be showing how easy and powerful it is using the CloudFlare and Fastly CDNs.

Cache tags

Instantaneous purging of all (and only!) the affected pages when an article is updated. No more manual purging by content editors. No more fiddling with URLs to purge. It all just works. Optimally.

Cache anonymous pages without any effort. On your own reverse proxy, and on many CDNs — thanks to standardized configuration.

This sounds nice, but that’s just the anonymous user case. What about authenticated users?

Cache contexts

The typical example: a shopping site, users categorized in groups according to interests, and a shopping cart.

Automatic caching of the entire page, minus the shopping cart, on the edge. Reused across all users in the same group. And, if the CDN supports it, even the shopping cart can be cached on the edge (and be kept up-to-date thanks to cache tags). Otherwise only thatneeds to talk to the origin (via AJAX, for example).

Cache authenticated pages without any effort.  On your own reverse proxy, and on some CDNs — thanks to standardized configuration.

Goals

  • The caching concepts
  • Demos
  • BigPipe, ESI, hybrid rendering strategies
  • A peek at the future: ServiceWorker
Conference: 
DrupalCon Barcelona
Location: 
Barcelona
Date: 
Sep 22 2015 - 17:00
Duration: 
60 minutes

Comments

jingsheng.wang's picture
jingsheng.wang

I was inspired by your Drupal CDN module in D7, and I have written a CDN (not a module), using Nginx with HTTP/2, GeoDNS and Docker (with less than 20 lines of code). I have tested this CDN with Linode & DigitalOcean in the past one year and half, average 4-16TB traffic per month. It works very well and saved A LOT of money.

I am looking forward to releasing it as an open source project, but I need to do more work to glue a few parts together. The idea is that a normal user can just do a few clicks (on Linode, DigitalOcean or AWS) to deploy a CDN node or clusters for a website.

What I hope to learn is how to support D8 cache tags and context as CDN provider/software? Can you please point me to the direction?

Wim Leers's picture
Wim Leers

Drupal 8’s responses have an X-Drupal-Cache-Tags header, which has a space-delimited list of strings. That’s how a CDN (or any reverse proxy) can figure out which responses should be invalidated when a tag is invalidated.

See: