Browser Caching and You: A Love Story

2,815 views

Published on

Exploration of the state of browser caching, as well as speculation on the future.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,815
On SlideShare
0
From Embeds
0
Number of Embeds
113
Actions
Shares
0
Downloads
43
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Browser Caching and You: A Love Story

  1. 1. Browser  Caching  &  You (a  love  story) Mark  Nottingham    /  mnot.net
  2. 2. At  First  Sight: The  Honeymoon
  3. 3. EMPTY FULL http://www.yuiblog.com/blog/2007/01/04/performance-research-part-2/
  4. 4. Relationship  Trouble
  5. 5. http://www.websiteoptimization.com/speed/tweak/average-web-page/
  6. 6. Mozilla:  50MB IE:  10%  (max  1G) Safari:  ?? Chrome:  8-­‐250M?
  7. 7. Mozilla:  100  pages
  8. 8. 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)
  9. 9. Cache-Control: max-age=0, ! no-cache, no-store, ! private, pre-check=0, ! post-check=0
  10. 10. “Maybe  we  should   start  seeing  other   people...”
  11. 11. HTML5  AppCache
  12. 12. • privacy  concerns  (“EverCookie”) • relationship  with  HTTP  caching  is  poorly   de]ined • designed  for  of]line  use
  13. 13. Getting  to  know each  other
  14. 14. Chrome 6 IE7 max-­‐age  /  expires
  15. 15. Safari 5.0.2 max-­‐age  /  expires Take-away: Cache timing is OK, but not exact
  16. 16. no-­‐cache  no-­‐store Take-away: no-store is enough
  17. 17. Age IE8
  18. 18. IE (any) Safari 5.0.2 Date
  19. 19. IE (most) pre-­‐check,  post-­‐check Take-away: max-age=0, pre-check=0, post-check=0 is a really bad idea.
  20. 20. Where  is  this  thing  going? (“the  talk”)
  21. 21. • Fixing  Bugs • Sizing  Caches  Appropriately • Replacement  Algorithms
  22. 22. cache stale-­‐while-­‐revalidate
  23. 23. stale-­‐if-­‐error
  24. 24. Cache  Invalidation
  25. 25. the internets POST/PUT/DELETE/etc. Request-URI Content-Location Cache Location origin server RFC  2616: Invalidations  after  Updates  or  Deletions
  26. 26. POST /articles/123/new_comment /newest_comments /articles/123/comments /comment_feed Problem:  Related  Responses
  27. 27. POST /articles/123/new_comment /newest_comments Link: </articles/123/new_comment>; rel=”invalidate /articles/123/comments Link: </articles/123/new_comment>; rel=”invalidated-by” /comment_feed Link: </articles/123/new_comment>; rel=”invalidated-by Link:  rel=invalidated-­‐by
  28. 28. POST /articles/123/new_comment /cat/vuvuzela /newest_comments Link: </articles/123/new_comment>; rel=”invalidate /bob/comments /articles/123/comments Link: </articles/123/new_comment>; rel=”invalidated-by” /comment_feed Link: </articles/123/new_comment>; rel=”invalidated-by Problem  3:  Dynamic  Relations
  29. 29. POST /articles/123/new_comment Link: </cat/vuvuzela>; rel=”invalidates” Link: </bob/comments>; rel=”invalidates” /cat/vuvuzela /newest_comments Link: </articles/123/new_comment>; rel=”invalidate /bob/comments /articles/123/comments Link: </articles/123/new_comment>; rel=”invalidated-by” /comment_feed Link: </articles/123/new_comment>; rel=”invalidated-by Link:  rel=invalidates
  30. 30. “side effect” invalidation + link relations = Linked Cache Invalidation
  31. 31. Further  Out (“there’s  still  life  in  this  thing”) • Cache  API  for  invalidation • Revisiting  of]line  caching • Forward  Cache  Digests • Explicit  Cache  Key

×