February 5, 2015
Why Domain Sharding is Important
Web browsers put a limit on the number of connections they will make to a host. This means a backlog of resources is always waiting to be downloaded.
While the browser will create as many simultaneous connections to the server as it can, the rest of the resources/files will remain queued, waiting for previous downloads to finish. Because time spent waiting for a connection means slower page load, reducing this “parallelization block” is essential to better performance.
One way to decrease the time a file spends waiting for an open connection is to create multiple sub-domains (eg. static1.domain.com, static2.domain.com). This way the number of resources downloaded in parallel is increased. 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.
Domain sharding can have a negative effect on performance if not done right. This is because it adds DNS request time as well as connection time to each new concurrent connection on the shard. However, if utilized correctly as illustrated below, you can drastically improve resource load time.
How to Improve Resource Load Time with Domain Sharding
You can parallelize downloads across hostnames with MaxCDN by creating multiple custom domains (CNAME records) and pointing them to the CDN URL (e.g. myzone.yourcompanyname.netdna-cdn.com).
It’s recommended you create between two to four custom domains (see CNAME records tutorial). After creating CNAME records, they need to be added under zone settings within “Custom Domains List” in your MaxCDN Control Panel.
There is a propagation time for DNS records that you can monitor with online tools like the Global DNS Propagation Checker.
When using this tool, keep in mind green checkmarks indicate that CNAME is propagated and is working at the specified location. If you are switching from existing records, you need to make sure that new ones are applied and propagated.
Utilizing parallel downloads can improve SEO. Why? Well in order to implement parallel downloads across host names, multiple CNAMEs need to point to your CDN (as described above). Since you are creating CNAMEs under your main domain DNS, search engines will treat your assets with more love as they are coming from a subdomain of your domain.
The sample below shows a single domain being used to load assets. As you can see, parallel downloading is severely limited.
The chart below illustrates how files are downloaded when domain sharding or hostname parallelization is implemented. (The difference is quite obvious.)
If you have any questions while implementing domain sharding with your MaxCDN account, feel free to contact our awesome CDN support team.