May 13, 2016
Domain sharding is a technique for splitting resources across multiple domains, improving page load time and search engine visibility. When multiple domains are used, browsers are able to download more resources simultaneously, resulting in a faster user experience.
To work around this limitation, web services split content across multiple subdomains. Since browsers reset the connection limit for each domain, each additional domain allows an additional number of active connections. This lets the user retrieve files from the same source with greater throughput.
How Domain Sharding Works
When a user connects to a web page, his or her browser scans the resulting HTML for resources to download. Normally these resources are supplied by a single domain: the domain providing the web page or a domain created specifically for resources. With domain sharding, the user’s browser connects to two or more different domains to simultaneously download the resources needed to render the web page.
Determining the number of domains
The number of shards used by a web service depends on the number of resources the user is required to download. Modern web browsers support on average 6 concurrent downloads per domain. This number is divided across the total number of resources to give the total number of requests. For example, a website with 30 resources has to do 6 sequential requests for a single user.
Adding multiple domains can, however, introduce performance losses. Web browsers have to perform a DNS lookup on each additional domain and maintain connections to each domain, resulting in slower initial load times. A study by Yahoo! shows 2 to 4 domains as the optimal ratio, with additional domains resulting in degraded performance.
To learn more about how domain sharding works and how to implement it with MaxCDN, check out this tutorial on parallelizing downloads across hostnames.
Domain sharding and SPDY
Google’s SPDY protocol introduced support for unlimited concurrent requests, solving the same issues as domain sharding with no additional setup. Although SPDY is used by only a small percentage of the web, its use has spread to some of the world’s largest websites including Google, Facebook, Twitter and WordPress.
While SPDY’s increased adoption will eventually make domain sharding obsolete, older browsers will continue to rely on domain sharding for increased performance.
Example of Domain Sharding
Because browsers distinguish domains by name rather than by IP address, domain sharding can be performed by a single web server. As long as the server has the bandwidth to support multiple concurrent connections, it can take advantage of domain sharding to quickly distribute content to visitors.
Benefits of Domain Sharding
Domain sharding is a proven tool for increasing web performance and throughput.
- Users see increased performance since webpages can download resources concurrently rather than sequentially.
- Enterprises see increased user satisfaction since users are able to view and interact with web pages more quickly.
- Enterprises and users see improved bandwidth usage, allowing more content to be delivered to more users faster.
An average of 50 requests are made on a single domain for the web’s top 300,00 URLs. That’s a lot of time spent waiting on resources to download, especially when some downloads can only start once others finish. Domain sharding can boost a website’s performance without adding a substantial amount of complexity.
Content delivery networks like MaxCDN provide the tools needed to quickly add multiple domains and speed up a website.