Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cache Me If You Can

Avatar for Lee Jones Lee Jones
September 21, 2014

Cache Me If You Can

An introduction to HTTP caching that covers Varnish, browsers, and CDNs. I gave this talk at CoderFaire 2014 on September 21.

Avatar for Lee Jones

Lee Jones

September 21, 2014
Tweet

More Decks by Lee Jones

Other Decks in Technology

Transcript

  1. GET /me HTTP/1.1 ! HTTP/1.1 200 OK X-Name: Lee Jones

    X-Twitter: @scribblethink X-GitHub: leejones X-Speaker-Deck: leejones
  2. !

  3. $

  4. ?

  5. HTTP/1.1 200 OK Content-Type: text/html ETag: "0dfdc6cc20e7c40f182b6dd6e85a9583" Cache-Control: private, max-age=0,

    must-revalidate ! <!DOCTYPE html> <body> … private max-age=0 must-revalidate
  6. Surrogate-Key: top-ten HTTP/1.1 200 OK Content-Type: text/html ETag: "0dfdc6cc20e7c40f182b6dd6e85a9583" Cache-Control:

    public, max-age=0, s-maxage=3600 Surrogate-Key: top-ten ! <!DOCTYPE html> <body> …
  7. Surrogate-Key: user-1234 HTTP/1.1 200 OK Content-Type: text/html ETag: "0dfdc6cc20e7c40f182b6dd6e85a9583" Cache-Control:

    public, max-age=0, s-maxage=3600 Surrogate-Key: user-1234 ! <!DOCTYPE html> <body> …
  8. TDD

  9. TDD

  10. TDD

  11. TDD

  12. links: Beginner’s Guide to HTTP Cache Headers: www.mobify.com/blog/beginners-guide-to-http-cache- headers/ Caching

    Tutorial: www.mnot.net/cache_docs HTTP Headers: www.w3.org/Protocols/rfc2616/rfc2616-sec14.html Varnish: www.varnish-cache.org Fastly: www.fastly.com/blog/ www.fastly.com/support/ Lonely Planet: www.lonelyplanet.com