Tips for configuring subdomain for fast static content delivery...?

Hi all,

Quick question. I’m moving all my static resources (CSS, JS, Flash, images) for my site over to a subdomain (well, three), so browsers can download the content in parallel to speed up load times. I was thinking of something simple like: (mirror of static1) (mirror of static1)

Has anyone done something similar? If so, any suggestions on how to ensure the fastest delivery times for the content? Maybe some sort of apache module configuration, disabling PHP… anything?

Any suggestions would be very welcome!!!

  • Ben

Yes, I’ve done it.

However, in the end, I couldn’t see any improvement in speed. It might be due to the order my scripts and css are called, as well as not being a very heavy site. The homepage leads to a max of 21 requests all told.

I’d be interested to hear how your tests go. Make sure to benchmark before and after.

Huh, interesting! I was planning on doing a big code + markup refactor while I was at it, but perhaps I’ll just test out the static content move first. If it does actually increase times (I’d be surprised!) then it becomes kind of self-defeating.

So you made no apache configuration changes on the static subdomain? Seems like there should be something I should do to speed things up on that front.

  • Ben

I did further testing after that post and it was inconclusive. I couldn’t get a reliable difference at all.

The only changes I made was to the framework I use. The templates were changed to point all images to rather than and the like. It wasn’t much that needed to be changed because I set up to just go straight to I’m not sure if it’s a symlink or a rewrite, but PHP would not see the request the same way, so I had to parse it a bit. Nothing major. The only benefit I found was audits of my site improved because images, css, and js were being served off of cookie-less (sub)domains, but I couldn’t see any real world advantage.

Again, I think it depends on your site. I have a low traffic wordpress site loaded with pictures and other goodies. I put that behind CloudFlare and saw a big improvement, but that’s because the load time was already 5-7 seconds or something like that. On the site where I tried the poor man’s CDN, even without the changes, the site loaded in under 2s, and often faster than 1.5, so there wasn’t much room for improvement.

That’s why I recommend setting some clear benchmarks before you make any changes.