A common technique for reducing page loading times is to parallelize multiple static resource downloads by retrieving them from different hostnames (even if they all resolve to the same server).
However, the browser needs to issue a DNS lookup request for each of these hostnames, which could take a significant time.
Can you propose a method using which the JavaScript code could determine on the fly the optimal number of hostnames to parallelize resource downloads over?
A common technique for reducing page loading times is to parallelize multiple static resource
Share
After the first time you resolve a given DNS name, the name should be cached by a resolver very close to the user. So if you want to get more parallel connections, just don’t use totally-random, off-the-wall servers; use a consistent set of five or so different hosts. The DNS load will only happen the first time a user hits your site (or, not even then, if someone sharing the same caching resolver has already been there) and will happen in parallel with the download of your page’s body.
JavaScript is ill-equipped to determine the “optimal” number, as it has no idea how long the DNS queries will take before issuing them.