Parallelize downloads across hostnames (deprecated) - Common Problems

Overview

While domain sharding can help improve the time it takes to load resources on the page, there are many things to be aware of before using domain sharding on your site.

What are the issues?

  • Domain sharding results in more DNS lookups (see Minimize DNS lookups) and takes extra time to make the initial connections. If you have too many shards, then you may hurt performance, so be sure to have enough resources to make the extra DNS lookup and connection time worth it. Future browsers will reduce the cost of the new connections by preconnecting to hosts (Chrome 7+ and IE9 already have this feature).
  • You must ensure that the resources are consistently served from the same sub-domains so that you don't lose the benefits of caching.
  • To achieve the full benefit of domain sharding, the resources should be distributed evenly amongst the domains.
  • If you are trying to distribute resources loaded from your CSS, then it can be difficult to distribute this between your sharded hosts.
  • If you have a HTTPS site, then there will be the added cost of buying SSL certificates for the sub-domains, or buying a wildcard SSL certificate. For sites that aren't entirely under HTTPS, you can serve these resources via the primary domain to avoid having to purchase SSL certificates for the sub-domains.
  • There may be a slightly higher load on the server due to the higher concurrent connections to the server.
  • For security reasons, browsers have a same origin policy to prevent cross domain violations. Moving your static content onto a separate domain or sub-domain can cause code to break if it depends on the data being from the same origin. Here are some common scenarios where the browser will not allow access to a different hostname:
    • Flash loading external data (XML, etc)
    • JavaScript manipulating or communicating with a page inside an iframe
    • JavaScript fetching a file via XMLHttpRequest
    • Other technologies such as Java applets or Silverlight fetching external data
  • Some home routers may incorrectly classify the large number of sharded requests as a denial of service attack if all the shards share a single IP (ie. CNAME). Depending on how many resources and how many sub-domains you use, this may or may not be an issue.

More Resources

« Back to Parallelize downloads across hostnames (deprecated)

Cookie Policy

By clicking "Allow All" you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View cookie details

Deny Allow All
×