WebPagetest Forums
Caching Static, question - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Discuss Test Results (/forumdisplay.php?fid=4)
+--- Thread: Caching Static, question (/showthread.php?tid=159)

Caching Static, question - jmueller0823 - 02-03-2010 07:54 AM

Our images and scripts are on the Amazon Cloudfront.
We've defined an expire header on each file -- yet we're
still seeing a low score in this category.

growth trac dot com

The headers are set to:
"EXPIRES" CONTENT="Sun, 17-Jan-2038 19:14:07 GMT

Pretty far in the future...
Any ideas?

Thanks much.

RE: Caching Static, question - pmeenan - 02-03-2010 10:15 PM

It looks like pagetest doesn't consider a bunch of your content "static" so it isn't counting a lot of the requests in the grade (look at the actual checklist).

For this object: http://d1tqw2pkoqqxbc.cloudfront.net/nav_01tellafriend_off.gif

it comes back with:

HTTP/1.0 200 OK
x-amz-id-2: UOgcJxd6D0+hM4YfA47/1YvRKYEVzCY66lNIyz7ugfIoXZXaEaRgHYQ7PC6bOl/J
x-amz-request-id: 08C1A65E9F5C2D0F
Date: Wed, 03 Feb 2010 01:32:33 GMT
Expires: Sun, 17-Jan-2038 19:14:07 GMT
Last-Modified: Tue, 02 Feb 2010 21:19:31 GMT
ETag: "c88585466ae9fbf5104049909682cacf"
Content-Type: binary/octet-stream
Content-Length: 684
Server: AmazonS3
Age: 38559
X-Cache: Hit from cloudfront
X-Amz-Cf-Id: 45f8c07b712a63af4ce89a9ff19955c51689f48f8cffaa7cf6378a3332f973344ddaf4e9ab1ddff4​
Via: 1.0 8a8618213617600186ecf6bd4987d76d.cloudfront.net:11180 (CloudFront), 1.0 bb422b41e9360f35e57a8ad7687dd21d.cloudfront.net:11180 (CloudFront)
Connection: keep-alive

The binary/octet-stream mime type is messing up pagetest because it only looks for images and text mime types to be static. I can look at extending that in the next release (probably in the next couple of days). Even your ccss and js get the wrong mime type Undecided

RE: Caching Static, question - jmueller0823 - 02-04-2010 12:42 AM

Thanks for the response.

[quote]Even your ccss and js get the wrong mime type[/type]

Please clarify: is that an issue I should/ need to resolve?
Or is Amazon messing us up?

RE: Caching Static, question - pmeenan - 02-04-2010 12:55 AM

I don't know that it is critical to clear up - the browsers apparently don't care that the mime type doesn't match the content but it's probably something you should be aware of.

RE: Caching Static, question - jlamons - 02-04-2010 06:52 AM

For what it's worth, here's a response header from an asset I have on cloudfront (the Content-Type seems fine):

x-amz-id-2 yv/ZuSQkIepns4o8rIHO2KL3bU4WeHLhiF7GsO1pOddH0iFSRHdTx79B3CcWrzX2
x-amz-request-id 7260D2D70B74E54E
Date Sun, 06 Dec 2009 04:47:04 GMT
Cache-Control public
Expires Mon, 02 Dec 2019 17:33:30 GMT+00:00
Last-Modified Fri, 04 Dec 2009 17:54:29 GMT
Etag "3342ec0f9dfe2ffd5f01c350a91247cb"
Content-Type image/jpeg
Content-Length 47554
Server AmazonS3
Age 5155866
X-Cache Hit from cloudfront
X-Amz-Cf-Id 288657f7c560703f9d0fb3229bc1f5c9931cbe4acfc07e37f6dd24332707700a51a5221b6a44bc59​
Via 1.0 5b1f6dfc9ebdbec2869a5bfa561dded0.cloudfront.net:11180 (CloudFront), 1.0 25d2bf6ddb741a48b3410c1f3e6cc922.cloudfront.net:11180 (CloudFront)
Connection keep-alive

RE: Caching Static, question - jmueller0823 - 02-15-2010 04:51 AM

I'm still trying to interpret the tool properly.

We get a bad grade for caching,
yet we are caching

We get a bad grade for use of a CDN,
yet we are using a CDN

We get a bad grade for combining files
- Is that the same as minifying?
Our css and js are minified.

Comments please. Thanks.

RE: Caching Static, question - pmeenan - 02-15-2010 08:27 AM

If you click on the checklist thumbnail and then scroll down below the checklist it will give you details about everything that failed. I don't think you're caching as well as you think you are:

FAILED (No max-age or expires) - http://ahsx1.adhostingsolutions.com/www/delivery/fl.js
FAILED (No max-age or expires) - http://cdn.socialtwist.com/2009041415306/script.js
FAILED (No max-age or expires) - http://cdn.socialtwist.com/getScriptJS.js
FAILED (No max-age or expires) - http://d14tk22m8i6bvj.cloudfront.net/jScrollPane.css
FAILED (No max-age or expires) - http://d14tk22m8i6bvj.cloudfront.net/main02-min.css
FAILED (No max-age or expires) - http://d14tk22m8i6bvj.cloudfront.net/panel-sitemap.css
FAILED (No max-age or expires) - http://d1tqw2pkoqqxbc.cloudfront.net/120x60_the-forums.gif
FAILED (No max-age or expires) - http//img-cdn.mediaplex.com/0/10629/94655/fom-webads-120x240.gif
FAILED (No max-age or expires) - http//img-cdn.mediaplex.com/0/10629/94655/fom-webads-120x522-2frame.gif
FAILED (No max-age or expires) - http//img-cdn.mediaplex.com/0/10629/94655/fom-webads-728x90.gif
FAILED (No max-age or expires) - http://www.growthtrac.com/floatbox/floatbox.css
FAILED (No max-age or expires) - http://www.growthtrac.com/floatbox/floatbox.js
FAILED (No max-age or expires) - http://www.growthtrac.com/floatbox/languages/en.json
FAILED (No max-age or expires) - http://www.growthtrac.com/images/bullet3.gif
FAILED (No max-age or expires) - http://www.growthtrac.com/includes/homepage.css
FAILED (No max-age or expires) - http://www.growthtrac.com/includes/slider-min.css
FAILED (No max-age or expires) - http://www.growthtrac.com/player/RadioPlayer.swf
FAILED (No max-age or expires) - http://www.growthtrac.com/xmenu/rm-data.js
FAILED (No max-age or expires) - http://www.growthtrac.com/xmenu/rm-images/col.gif
FAILED (No max-age or expires) - http://www.growthtrac.com/xmenu/rm-images/rc/cp.png
FAILED (No max-age or expires) - http://www.growthtrac.com/xmenu/rm-images/xmenu-sep.gif
FAILED (No max-age or expires) - http://www.growthtrac.com/xmenu/rm-kernel-js.js
FAILED (No max-age or expires) - http://www.growthtrac.com/xmenu/rm-style.css
WARNING (24.0 hours) - http://edge.quantserve.com/quant.js
WARNING (7.0 days) - http://www.google-analytics.com/ga.js

It still has the problem where it isn't counting your content served from cloudfront because of the mime types though.

Combine CSS and JS isn't about minifying, it is about reducing the number of separate js and css files that are loaded in the head. You should only have one of each with all of the code merged into a single file. In this case your situation is worse than the tool is identifying because of the mime type issue with your setup. Looks like you have at least 8 separate css files and 12 js files. The js is particularly bad because with IE7 (and Firefox < 3.6) the browser "blocks" on javascript files and doesn't download anything else when it is downloading a script file. If at all possible you should move as much code as possible to the bottom of the file instead of loading it in the head because anything you load in the head needs to be loaded before the browser will display anything (causing long "start render" ttimes).