Mobile app version of vmapp.org
Login or Join
Pope3001725

: Cache external static scripts? 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

@Pope3001725

Posted in: #Cache #PageSpeed #Performance

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) fonts.googleapis.com/css?... (2011/7/6) fonts.googleapis.com/css?... (no expires) 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)

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


This answer on SO:
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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Pope3001725

2 Comments

Sorted by latest first Latest Oldest Best

 

@Nickens628

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!]

10% popularity Vote Up Vote Down


 

@Sarah324

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme