Seeing the “parallelize downloads across hostnames” warning in Pingdom, GTmetrix, or Google PageSpeed Insights? This is because web browsers are limited to the number of concurrent connections they can make to a host. This is mainly due do HTTP/1.1 in which browsers open on average 6 connections per hostname. This warning is typically seen on websites with a large number of requests. In the past the only way to get around this limitation is to implement what they call domain sharding.

parallelize downloads across hostnames

Note: If you are running over HTTPS with a provider that supports HTTP/2, this warning can usually be safely ignored now. With HTTP/2 multiple resources can now be loaded in parallel over a single connection.

Depending upon the tool or software reporting it, the warning might appear in a couple different ways:

  • “parallelize downloads across hostnames”
  • “increase download parallelization by distributing these requests across multiple hostnames”

pingdom parallelize downloads across hostnames

If you are still running over HTTP and haven’t migrated to HTTP/2 yet, you can follow the tutorial below on how to implement domain sharding. Again, most of the techniques are now considered deprecated. Over 77% of browsers now support HTTP/2 when running over HTTPS, as well as many CDN and web hosting providers, including Kinsta. It is also important to note that Pingdom doesn’t support HTTP/2 yet since it uses an older version of Chrome.

Fix “Parallelize Downloads Across Hostnames” Warning

Domain sharding refers to spreading out your assets across multiple subdomains. By doing this you can multiply the number of simultaneous requests. Using domain sharding also gives you the ability to load content on cookie-free subdomains. However, it is also important to note that there are a couple drawbacks to this. By introducing additional subdomains you are adding more DNS requests which increases resolution times and you lose a lot of your caching benefits. Follow the steps below to set it up.

1. Setup Additional Subdomains

The first thing you will need to do is create additional subdomains and or CNAME records to spread across the request for your static assets. You can do this at your DNS registrar or if you are a Kinsta customer you can also edit your DNS records from within your My Kinsta dashboard. Typically no more than 4 are recommended. You will want to point your additional CNAMEs at your /wp-content directory. An example of a configuration might be:

domain.com
static1.domain.com
static2.domain.com
static3.domain.com

2. Edit WordPress Config

You then have to configure WordPress to parallelize the downloads across subdomains. Simply add the following code to your WordPress theme’s functions.php file (src: GitHub). And replace the $subdomains values with your subdomains. All subdomains/hostnames MUST have the same structure/path.

function parallelize_hostnames($url, $id) {
 $hostname = par_get_hostname($url); //call supplemental function
 $url = str_replace(parse_url(get_bloginfo('url'), PHP_URL_HOST), $hostname, $url);
 return $url;
}
function par_get_hostname($name) {
 $subdomains = array('media1.mydomain.com','media2.mydomain.com'); //add your subdomains here, as many as you want.
 $host = abs(crc32(basename($name)) % count($subdomains));
 $hostname = $subdomains[$host];
 return $hostname;
}
add_filter('wp_get_attachment_url', 'parallelize_hostnames', 10, 2);

This same technique above can also be used with CDN providers such as KeyCDN, MaxCDN, and CloudFlare to fix the “parallelize downloads across hostnames” warning. However, almost all CDN providers now support HTTP/2 in which domain sharding is not recommended. And you can still serve assets from a CDN via HTTPS even if you haven’t migrated your WordPress site yet to HTTPS.

Related Articles

Haven't Found What You Need?

Head back to the knowledge base or open a support ticket

Back To The Knowledge Base Open A Support Ticket
email newsletter

Use WordPress?

Join 15,000+ others who get our FREE weekly newsletter with WordPress tips on how to drive more traffic and revenue to your business!

You have Successfully Subscribed!

Send this to a friend