Websites that load faster are more engaging and more likely to make conversions, here’s how I do it.

Domain Sharding

Web browsers put a limit on the number of concurrent connections they will make to a host. When there are many resources that need to be downloaded, a backlog of resources waiting to be downloaded will form. The browser will make up as many simultaneous connections to the server as the browser allows in order to download these resources, but then will queue the rest and wait for the requests to finish.

The time spent waiting for a connection to finish is referred to as blocking and reducing this blocking time can result in a faster loading page. The waterfall diagram below shows a page which loads 45 resources from the same host. Notice how long the resources are blocked (the brown segments), before they are downloaded (the purple segments) as they wait for a free connection.

One way to improve the situation is to create multiple sub-domains (eg. static1.gtmetrix.com, static2.gtmetrix.com) so that the number of resources downloaded in parallel is increased. This is referred to as “domain sharding.” Because browsers limit connections on a per host basis, creating a sub-domain adds a new pool of connections that the browser can make, allowing more resources to be downloaded at the same time. Taking the same page as above and splitting the resource requests between two domains, you can see that a lot less time is spent blocking and the page loads about 33% faster:

Domain sharding can have a negative effect on performance – it adds DNS request time as well as connection time to each new concurrent connection to the shard (as seen by the green segments in the waterfall); but if utilized correctly, can drastically improve resource load time. Before implementing it, you should read more about the common problems with domain sharding.

Recommendations

Your first step towards reducing blocking time should be the reducing the number of resources needed to be downloaded (eg. combine external CSS/JS and use sprites). However, in situations where these optimizations don’t help as much (eg. a shopping or image gallery where you can’t sprite the images),domain sharding can often help alleviate the problem.

If your site spends a significant time blocking, or a majority of your users use a older browser like IE6/7, then implementing domain sharding should result in significant performance gains. However, depending on how URLs are generated and where resources are being loaded from, implementing domain sharding can be a difficult and time consuming task. If you’ve already reduced the number resources your site loads but still aren’t happy with performance, domain sharding is worth a try.

Browser limitations

http://www.browserscope.org/?category=network&v=top

Browser Concurrent Connections

BrowserCC per hostname (HTTP/1.1)Maximum Conns
IE 6, 7235
IE 8, 9635
Firefox 2224
Firefox 3, 4630
Safari 3460
Safari 4, 5630
Chrome 1, 2660
Chrome 3460
Chrome 4660
Chrome 5, 6, 7630
Chrome 8, 9, 10635
Opera 9420
Opera 10830
Opera 111664

About Gary Hicks

Gary Hicks is a professional website and graphics designer with more than 14 years experience. Having worked in London, Mexico City and Tokyo, Japan Gary is now based in Bournemouth and Windsor where he concentrates on work and staying fit.

Leave a Reply

Your email address will not be published.