Browser Caching and You - A Love Story

Browser Caching and You - A Love Story

Over time, Web developers have feared, hated and loved Web caching, at times trying to kill it, at others professing undying love. Mark Nottingham (chair of the IETF HTTPbis Working Group and author of its revised Web Caching specification) will examine how browsers (mis)-treat your content today, as well as where your relationship with browser caching might go in the future.

38f92fdb9ac1b5213d40c595b14ec620?s=128

Mark Nottingham

October 15, 2010
Tweet

Transcript

  1. Browser Caching & You (a love story) Mark Nottingham /

    mnot.net
  2. At First Sight: The Honeymoon

  3. EMPTY FULL http://www.yuiblog.com/blog/2007/01/04/performance-research-part-2/

  4. None
  5. Relationship Trouble

  6. http://www.websiteoptimization.com/speed/tweak/average-web-page/

  7. Mozilla: 50MB IE: 10% (max 1G) Safari: ?? Chrome: 8-250M?

  8. Mozilla: 100 pages

  9. Mozilla: 16384 entries 89 // Min and max values for

    the number of records in the DiskCachemap 90 #define kMinRecordCount 512 91 92 #define kSeparateFile 0 93 // #define must always be <= 65535KB, or overflow. See bug 443067 Comment 8 94 #define kMaxDataFileSize 5 * 1024 * 1024 // 5 MB (in bytes) 95 #define kBuckets (1 << 5) // must be a power of 2! (~230 pages)
  10. Cache-Control: max-age=0,  no-cache, no-store,  private, pre-check=0,  post-check=0

  11. “Maybe we should start seeing other people...”

  12. HTML5 AppCache

  13. None
  14. • privacy concerns (“EverCookie”) • relationship with HTTP caching is

    poorly de^ined • designed for of^line use
  15. Getting to know each other

  16. None
  17. max-age / expires Chrome 6 IE7

  18. max-age / expires Safari 5.0.2 Take-away: Cache timing is OK,

    but not exact
  19. no-cache no-store Take-away: no-store is enough

  20. Age IE8

  21. Date Safari 5.0.2 IE (any)

  22. pre-check, post-check Take-away: max-age=0, pre-check=0, post-check=0 is a really bad

    idea. IE (most)
  23. Where is this thing going? (“the talk”)

  24. • Fixing Bugs • Sizing Caches Appropriately • Replacement Algorithms

  25. stale-while-revalidate cache

  26. stale-if-error

  27. Cache Invalidation

  28. RFC 2616: the internets Cache origin server POST/PUT/DELETE/etc. Invalidations after

    Updates or Deletions Request-URI Content-Location Location
  29. Problem: Related Responses POST /articles/123/new_comment /newest_comments /articles/123/comments /comment_feed

  30. Link: rel=invalidated-by POST /articles/123/new_comment /newest_comments /articles/123/comments /comment_feed Link: </articles/123/new_comment>; rel=”invalidate

    Link: </articles/123/new_comment>; rel=”invalidated-by” Link: </articles/123/new_comment>; rel=”invalidated-by”
  31. Problem 3: Dynamic Relations POST /articles/123/new_comment /newest_comments /articles/123/comments /comment_feed Link:

    </articles/123/new_comment>; rel=”invalidate Link: </articles/123/new_comment>; rel=”invalidated-by” Link: </articles/123/new_comment>; rel=”invalidated-by” /bob/comments /cat/vuvuzela
  32. Link: rel=invalidates POST /articles/123/new_comment /newest_comments /articles/123/comments /comment_feed Link: </articles/123/new_comment>; rel=”invalidate

    Link: </articles/123/new_comment>; rel=”invalidated-by” Link: </articles/123/new_comment>; rel=”invalidated-by” /bob/comments /cat/vuvuzela Link: </cat/vuvuzela>; rel=”invalidates” Link: </bob/comments>; rel=”invalidates”
  33. Linked Cache Invalidation “side effect” invalidation + link relations =

  34. Further Out (“there’s still life in this thing”) • Cache

    API for invalidation • Revisiting of^line caching • Forward Cache Digests • Explicit Cache Key