Monday, August 31, 2009

Using Subdomains for Speed Optimisation


There are few small things that accelerate your website loading. The time difference may be in seconds.. but it makes huge difference in user experience perspective. Yes its true.


If you load your images and javascript and css files from your sub-domains your website loading time may be decreased by half.

Not believable?

Here is the secret...

The current HTTP protocol accepts only two simultaneous connections from a domain. So if you use your images css and js from single domain, they all will be queued up waiting for their turn. If you load your images from images.your-web-site.com and js and css from somesubdomain.your-web-site.com then all  your html page, images and js, css files will load paralelly.

Where is the proof?

images.google.com

Search for any images there and see the properties of all ten images.


They loads from 

tbn0.google.com

tbn1.google.com

tbn2.google.com

tbn3.google.com

So the loading time is very very less. The images loads quicker, parallel, fast .

Another Secret

You can make this magic using .htaccess. you don't really need to place your current components into original subdomain. You can write an .htaccess in the subdomain to redirect all the requests to your original domain.

So... Why can't you try it today..


Post your comments here if you have any questions. I would happy to answer.. :)

No comments:

Post a Comment