Last night at the Sencha Chicago User Group, I gave a presentation titled AJAX Communication in Sencha Touch and ExtJS. The premise of the talk was that all websites (and web applications) should be optimized to be as fast as possible.
During the talk, I kept harping on the fact that browsers are limited to the number of HTTP requests they can make per domain. This isn’t anything new… lots of people have talked about this before. But I realized that I wasn’t practicing what I preached – my own website didn’t utilize the idea of subdomains for requesting JS, CSS, or other file types.
I took some time late last night to create a series of subdomains – js.akawebdesign.com, css.akawebdesign.com, and img.akawebdesign.com.
The key is that they all point to the same directory on the server. I didn’t move the files around the filesystem, mainly because I’m lazy. The process I’ve put in place simply fools the browser into thinking the files are in some other domain… which opens up the number of HTTP requests available. DNS saves the day!
The result is that I’ve managed to shave about 1/4 of a second off the loading time for my website! See the screenshots below:
Was it worth it?
1/4 of a second may not seem like a lot, but for larger websites or applications that number might be dramatically more effective.
The caveat here is that those numbers I showed above depend on a lot of things. Caching, network speed, website traffic… any of those could effect the speed my visitors experience at any given moment.
But overall, it’s an improvement. Faster is always better than slower.