CS193H:%20High%20Performance%20Web%20Sites%20Lecture%207:%20Add%20an%20Expires%20Header - PowerPoint PPT Presentation

About This Presentation
Title:

CS193H:%20High%20Performance%20Web%20Sites%20Lecture%207:%20Add%20an%20Expires%20Header

Description:

myspace.com. 21/21. 7/7. 4/4. 100%. na. en.wikipedia.org/wiki. 7/32. 5/5. 9/9 ... won't be cached by some proxies. Homework 'Improving Top Site' class project: ... – PowerPoint PPT presentation

Number of Views:136
Avg rating:3.0/5.0
Slides: 11
Provided by: steves7
Category:

less

Transcript and Presenter's Notes

Title: CS193H:%20High%20Performance%20Web%20Sites%20Lecture%207:%20Add%20an%20Expires%20Header


1
CS193HHigh Performance Web SitesLecture 7 Add
an Expires Header
  • Steve Souders
  • Google
  • souders_at_cs.stanford.edu

2
Announcements
  • No more hardcopy handouts view/annotate online

3
Expires header
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-javasc
ript Last-Modified Mon, 22 Sep 2008 211435
GMT Content-Length 2066 Content-Encoding
gzip Expires Mon, 12 Oct 2009 145734
GMT Cache-Control max-age31536000 XmoÛHþ\ÿFÖvã
wØoq...
  • Expiration date determines freshness.
  • Can also use Cache-Control max-age

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 145734 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
  • ltFilesMatch "\.(gifjpgjscss)"gt
  • ExpiresDefault "access plus 1 year"
  • lt/FilesMatchgt
  • sends both Expires and max-age
  • Expires Mon, 12 Oct 2009 145734 GMT
  • Cache-Control max-age315360000

6
Expires in the Wild 2007
Images Scripts Stylesheets with Expires Median Age
amazon.com 0/62 0/3 0/1 0 114 days
aol.com 23/43 6/18 1/1 48 217 days
cnn.com 0/138 2/11 0/2 1 227 days
ebay.com 16/20 0/7 0/2 55 140 days
froogle.google.com 1/23 0/1 0/1 4 454 days
msn.com 32/35 3/9 1/1 80 34 days
myspace.com 0/18 0/2 0/2 0 1 day
wikipedia.org 6/8 2/3 1/1 75 1 day
yahoo.com 23/23 4/4 1/1 100 na
youtube.com 0/32 0/7 0/3 0 26 days
average 10/40 (25) 2/5 (38) 0.5/2 (27) 12/46 (26)
  • March 2007

7
Expires in the Wild 2008
Images Scripts Stylesheets with Expires Median Age
aol.com 26/35 13/20 1/1 71 189 days
ebay.com 48/48 6/7 2/2 98 1 day
facebook.com 93/97 20/22 20/20 96 121 days
google.com/search 1/1 0/1 0/0 50 1 day
search.live.com/results 6/6 1/1 4/4 100 na
msn.com 45/45 3/3 3/3 100 na
myspace.com 21/21 7/7 4/4 100 na
en.wikipedia.org/wiki 7/32 5/5 9/9 46 310 days
yahoo.com 23/23 4/4 1/1 100 na
youtube.com 8/27 1/1 1/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 gt 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 2359 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?
Write a Comment
User Comments (0)
About PowerShow.com