Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimizing HTTP Connections vs. Parallel Downloads

For years, web developers have followed the logic that minimizing HTTP connections speeds up applications because the browser isn't choking on the download/execution of code. For example Yahoo has long touted their best practices, and tell us to combine CSS/JavaScript/image resources into single files - thereby reducing the total number of HTTP requests and compressing the total resource size.

But other "best practices" exist with regards to increasing webpage speed - specifically, maximizing the number of parallel HTTP downloads (from Google). This approach tells us that by spreading the HTTP connections across multiple hostnames the browser can do more simultaneously.

So as modern web applications are becoming very large (e.g. 3MB+ of JavaScript alone) the question must be asked:

Will my application load faster with 3MB+ of JavaScript in a single file? Or will it load faster with multiple, smaller files spread across hostnames?

For the sake of simplicity we should also assume other "best practices" are being followed, so this question best exists in a vacuum.

I have yet to see any empirical data on the subject, but I imagine there has to be a point where the performance of these approaches diverge - so knowing where that sweet-spot exists would be ideal.

like image 589
arthurakay Avatar asked Aug 05 '14 12:08

arthurakay


People also ask

Is parallel downloading faster?

Parallel downloads, also known as domain sharding, reduce the time it takes for a connection to be complete which results in faster page loading and download speeds.

What does concurrent download mean?

ABSTRACT. Concurrent downloads accelerate information access speed for individual web users. The speed-up comes from multiple connections launched for one subject download, which leads to unfairness at user level. In this paper, we study the impact of concurrent downloads on the network.

What is parallel downloading in Chrome?

Parallel downloading creates three separate download “jobs” to accelerate the downloading of large files. Enabling this Flag can make downloads of large files much faster.


1 Answers

I think this depends on number of sockets available for the browser. Say the browser has it's 4 sockets available, 4 smaller requests will be faster than 1 large request.

The trick here would be knowing at startup what requests your application will send and maximize the # of requests for # of sockets a browser can use. I believe browsers only have 4 but to be honest I haven't ever looked to see if that number has changed in modern browsers.

Looks like each browser can have it's own number of sockets, some having 2: Max parallel http connections in a browser?

https://stackoverflow.com/a/985704/925782 says IE10 is winner with 8 sockets, wow, go IE :)

Cache control would also play part in this of course where first load would be everything, subsequent loads would be less actual requests.

If you want to get geeky: http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/

I agree that some charts and real data would be a great blog post, my response is purely theoretical in nature.

like image 194
Mitchell Simoens Avatar answered Sep 29 '22 18:09

Mitchell Simoens