Create a Subdomain to Parallelize Downloads
You know when running Google’s Page Speed on a site there is many issues Google recomends you to fix.
One of that problems is Parallelize Downloads. When you have JS, CSS, IMAGE and all those kind of files serving from 1 single domain it slows down the speed.
Did you heard about Content Delivery Networks?
A CDN serves the static content of your site from multiple servers arround the world depending on where your reader is.
As you can imagine this services are expensive and if you’re like me you can’t pay for that.
There is a solution to cheat on Google’s Page Speed.
Create a subdomain like I did cdn.quicoto.com. Upload the static content there (some CSS, JS and IMAGES). [UPDATE] Well in fact you’re. Check out the comment for the full explanation 1. Upload static content
Am I speeding up my site?
Related Posts




June 2, 2010
23:10
Hi Quicoto,
I’d like to share my point of view about this scenario.
You’re right about the “speed” of the server; you’re not going to get better response times by solely linking your files with another URL (aka alias). The thing here is that you can improve significantly the overall response time of your site by using several aliases.
According to the HTTP 1.1 specification, most of web browsers establish 2 or 3 threads per host at a time. For example, if you have 10 images in your home page, you will have to wait for the browser to download them in “blocks” of two, because of this limitation. If we suppose that every image takes 10ms to load, you’ll have to wait 50 ms.
If you use 3 different hosts you can get over this limitation. For example, if you distribute your images across different hosts, you’d have to wait (theoretically) only 20 ms, which is an amazing improvement in performance.
There are tons of posts about this subject, and I’d like to share one with you:
http://www.websiteoptimization.com/speed/tweak/parallel/
I hope this helps for future reference. As you can see, this is not only for cheating Google Page Speed but to actually reduce the load time of your sites.
Best regards
June 3, 2010
00:18
Thank you very much for your comment.
I love learning new things like this every day
Would be nice to to read you here often
Regards
June 3, 2010
06:33
You’re welcome.
It happens that I’m in trouble because of this right now. I need to parallelize downloads (I use a lot of thumbs in the homepage) and this technique certainly works.
I suggest you to install Firebug (if you haven’t yet) and watch the “Net” tab as it shows in real time how long does it take for an object to load in your site and it even displays a nice graphic which is quite useful
I’m a big fan of your photos ^^, very nice job.
June 3, 2010
08:28
Sure I have it. Could not live without it
About the thumbs… do you think it’s really posible to change that? I mean..in my theme it take the image from the post attachment. I think it would mean a lot of new and not easy code
cheers.
June 5, 2010
04:57
At a first sight I don’t think it’s as though as it might sound. For example, what I’d do is create an array of URLs, and then randomly (or not), choose one to load the file. For example:
url[0] = “http://yoursite.com/images/filename.ext”
url[1] = “http://static1.yoursite.com/images/filename.ext”
url[2] = “http://static2.yoursite.com/images/filename.ext”
print random url
Of course you’d have to point all your subdomains to the proper locations. Basically what I’d do is load an image from a “random” location. For performance test I’d make the plugin to load a file from different URLs for example, every 2 files or 3, which is not hard to implement either (in my humble opinion, and I’m not a great programmer at all).
This can be an excellent exercise for you to both improve your site’s performance and begin feeling comfortable with PHP and wordpress plugin “hacking”.
I’m trying to find out how am I going to fix this in my site which is not built upon WordPress, so it changes a little bit, but the logic is the same I described before.
Cheers
June 5, 2010
10:28
But why random?
if I have 2 images in my site and I want to slit it into 2 subdomains i’ll do:
subdomain.domain.com/image1.jpg
subdomain2.domain.com/image2.jpg
Why I need to create more subdomains for the same image?
June 5, 2010
20:34
The random method is suitable in my case because I don’t have control over the location of the images. For example, if I publish a new post, the image will be saved into a directory, for example domain.com/images/hello.png. A plugin will generate a thumb in domain.com/cache/sd0a8sd4ewf.png. As you can see, I can’t control where the thumbs will be saved and that’s why I’d need to spread the images across multiple hosts.
If I had control of where the images will be placed, I’d choose the location manually; the random method was just a suggestion