Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS193H: High Performance Web Sites Lecture 7: Add an Expires Header Steve Souders Google

Similar presentations


Presentation on theme: "CS193H: High Performance Web Sites Lecture 7: Add an Expires Header Steve Souders Google"— Presentation transcript:

1 CS193H: High Performance Web Sites Lecture 7: Add an Expires Header Steve Souders Google souders@cs.stanford.edu

2 Announcements No more hardcopy handouts – view/annotate online

3 Expires header Expiration date determines freshness. Can also use Cache-Control: max-age GET /v-app/scripts/107652916-dom.common.js HTTP/1.1 Host: www.blogger.com User-Agent: Mozilla/5.0 (…) Gecko/2008070208 Firefox/3.0.1 Accept-Encoding: gzip,deflate HTTP/1.1 200 OK Content-Type: application/x-javascript Last-Modified: Mon, 22 Sep 2008 21:14:35 GMT Content-Length: 2066 Content-Encoding: gzip Expires: Mon, 12 Oct 2009 14:57:34 GMT Cache-Control: max-age=31536000 XmoÛHþ\ÿFÖvã*wØoq...

4 Expires vs. max-age Expires works in HTTP/1.0, max-age in HTTP/1.1 Expires is an absolute date: 12 Oct 2009 14:57:34 GMT max-age is # of seconds until expiration: 31536000 Expires relies on clock synchronization between client and server for short expirations max-age takes precedence over Expires

5 Sending Expires (Apache) mod_expires ExpiresDefault "access plus 1 year" sends both Expires and max-age: Expires: Mon, 12 Oct 2009 14:57:34 GMT Cache-Control: max-age=315360000

6 Expires in the Wild – 2007 ImagesScriptsStylesheets % with Expires Median Age amazon.com 0/620/30/10%114 days aol.com 23/436/181/148%217 days cnn.com 0/1382/110/21%227 days ebay.com 16/200/70/255%140 days froogle.google.com 1/230/1 4%454 days msn.com 32/353/91/180%34 days myspace.com 0/180/2 0%1 day wikipedia.org 6/82/31/175%1 day yahoo.com 23/234/41/1100%na youtube.com 0/320/70/30%26 days average 10/40 (25%) 2/5 (38%) 0.5/2 (27%) 12/46 (26%) March 2007

7 Expires in the Wild – 2008 ImagesScriptsStylesheets % with Expires Median Age aol.com 26/3513/201/171%189 days ebay.com 48/486/72/298%1 day facebook.com 93/9720/2220/2096%121 days google.com/search 1/10/10/050%1 day search.live.com/results 6/61/14/4100%na msn.com 45/453/3 100%na myspace.com 21/217/74/4100%na en.wikipedia.org/wiki 7/325/59/946%310 days yahoo.com 23/234/41/1100%na youtube.com 8/271/1 34%unk average 28/34 (83%) 6/7 (85%) 5/5 (100%) 38/45 (85%) October 2008

8 Revving Filenames really, this is independent of Expires headers once you make a resource public, you can never change it => aggressive proxies prevent 100% of users from getting the update best solution: change the filename date: trough_062308.gif version #: onload_1.6.1.js checksum: 1076572916-dom.common.js don't use querystring: wikibits.js?179 won't be cached by some proxies

9 Homework "Improving Top Site" class project: first set of improvements due by 23:59 Mon 10/22 THIS WILL AFFECT YOUR GRADE includes improvements from Rules 1-4 measure improvements using Hammerhead record results in your personal Web 100 sheet include URLs that I can check (in your sheet) read Chapter 4 of HPWS for 10/15

10 Questions What's are some differences between Expires and max-age? What types of resources should an Expires header be used with? Once a resource is cached with a far future expiration date, how can you push updates and ensure users get the new version?


Download ppt "CS193H: High Performance Web Sites Lecture 7: Add an Expires Header Steve Souders Google"

Similar presentations


Ads by Google