Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

In my never ending quest for a faster website, I thought perhaps I could cache some scripts. I'm using Yslow to rate my site, everything is pretty much A (which is great, our website on Pingdom loads in 0.4-0.6 seconds which is 5-20x quicker than our competitors) except two things:

Add expire headers:

(2011/7/7) http://fonts.googleapis.com/css?...
(2011/7/6) http://fonts.googleapis.com/css?...
(no expires) http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4d7a205f1e2a0b4b

And too many DNS lookups:

The components are split over more than 4 domains

static1.scirra.net: 4 components, 19.3K (4.3K GZip)

fonts.googleapis.com: 2 components, 0.8K (0.5K GZip)

static3.scirra.net: 2 components, 5.5K (2.7K GZip)

static4.scirra.net: 3 components, 12.7K

static2.scirra.net: 3 components, 76.6K

s7.addthis.com: 3 components, 126.3K (40.4K GZip)

ajax.googleapis.com: 1 component, 78.6K (27.1K GZip)

www.scirra.com: 1 component, 8.0K (3.3K GZip)

This answer on SO:

http://stackoverflow.com/questions/1439042/how-can-i-add-expire-headers-for-scripts-that-are-not-on-my-server/1439128#1439128

Suggests having an intermediatory caching script, which fetches these and serves them from your own server.

Thoughts? If you're a speed nut like me can we expect to shave some loading time off for the users at the expense of our bandwidth?

share|improve this question
1  
Note: there is a tradeoff if you cache them locally on your server... as you increase the load on your own server for those files when un-cached, and reduce the pipelining abilities of the browser by moving the scripts from a CDN developer.yahoo.com/performance/rules.html#cdn back onto your local server. –  scunliffe Jul 7 '11 at 17:18
add comment

2 Answers 2

up vote 7 down vote accepted

Moving unique static files to your own domain to reduce domain lookups and control expire headers is a good idea, provided you're prepared to check the master files for changes periodically.

Moving common static files to your own domain is not always a good idea, because you lose the benefit if they're already cached from another site the user may have visited. (e.g. Google Web Fonts and the JavaScript files hosted within the Google Libraries API.)

[Aside: To my knowledge, pingdom measures server response time, not page load time, but 0.6 seconds still sounds fast!]

share|improve this answer
add comment

Bandwidth is almost a commodity at this point. Especially if you're compressing your files before sending them to the user. And since page speed has been proven to affect not only search rankings but, more importantly, conversion rates, I would say this is not a bad strategy to employ. Just make sure your caching engine accounts for updates to any of the external scripts you are caching. Being out of sync with them may cause undesirable results.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.