max number of concurrent file downloads in a browser?

Two related questions:

  1. What are the maximum number of concurrent files that a web page is allowed to open (e.g., images, css files, etc)? I assume this value is different in different browsers (and maybe per file type). For example, I am pretty sure that javascript files can only be loaded one at a time (right?).

  2. Is there a way I can use javascript to query this information?

Answers:

Answer

One interesting way to get around the X connections per server limit is to map static resources like scripts and images to their own domains... img.foo.com or js.foo.com.

I have only read about this - not actually tried or tested. So please let me know if this doesn't work.

Answer

For Internet Explorer see this MSDN article. Basically, unless the user has edited the registry or run a 'internet speedup' program, they are going to have a maximum of two connections if using IE7 or earlier. IE8 tries to be smart about it and can create up to 6 concurrent connections, depending on the server and the type of internet connection. In JavaScript, on IE8, you can query the property window.maxConnectionsPerServer.

For Firefox, the default is 2 for FF2 and earlier, and 6 for FF3. See Mozilla documentation. I'm not aware of anyway to retrieve this value from JavaScript in FF.

Most HTTP servers have little ability to restrict the number of connections from a single host, other than to ban the IP. In general, this isn't a good idea, as many users are behind a proxy or a NAT router, which would allow for multiple connections to come from the same IP address.

On the client side, you can artificially increase this amount by requesting resources from multiple domains. You can setup www1, www2, etc.. alias which all point to your same web server. Then mix up where the static content is being pulled from. This will incur a small overhead the first time due to extra DNS resolution.

Answer

The limitiation is usually the web server. It's common that a web server only allows two concurrent downloads per user.

Active scripting engines like ASP.NET only executes one request at a time per user. Requests for static files are not handles by the scripting engine, so you can still get for example an image while getting an aspx file.

Pages often have content from different servers, like traffic measuring scripts and such. As the download limit is per server you can typically download two files at a time from each server.

As this is a server limitation, you can't find out anything about it using javascript.

Answer
  1. This is both a server and browser limitation. General netiquette holds that no more than 4 simultaneous connections are allowable. Most server allow a maximum of 2 connections by default, and most browsers follow suit. Most are configurable.
  2. No.
Answer

I know at least in Firefox, this value is configurable (network.http.max-connections, network.http.max-connections-per-server, and network.http.pipelining.maxrequests), so I doubt you'll get a definitive answer on this one. The default is 4, however.

What are you attempting to accomplish?

Answer

There is nothing in HTTP that limits the number of sessions.

However, there are configuration items in FF for one, that specifically set how many total sessions and how many sessions to a single server are allowed. Other browsers may also have this feature.

In addition, a server can limit how many sessions come in totally and from each client IP address.

So the correct answer is:

1/ The number is sessions is limited to the minimum of that imposed by the client (browser) and server.

2/ Because of this, there's no reliable way to query it in JavaScript.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.