Firefox 3 beta 5: How many connections is too many?

I woke up this morning to an auto-update message from Firefox saying that beta 5 was available. Aside from some polish and a few bug fixes, beta 5 does have one big change over the last version: by default it will now keep three times as many connections to the server open at once.

Firefox 3 beta 5 is out

I woke up this morning to an auto-update message from Firefox saying that beta 5 was available. Aside from some polish and a few bug fixes, beta 5 does have one big change over the last version: by default it will now keep three times as many connections to the server open at once. This change is somewhat controversial so let's look at it in a bit more depth.

When you open a web page that has many different objects on it, like images, Javascript files, frames, data feeds, and so forth, the browser tries to download several of them at once to get better performance. The effect is dramatic for the user, but hard on web servers.

Most HTTP servers and browsers use a protocol called "keep-alive" that doesn't close the connection when the client is done with it. This makes sense; opening a remote connection is expensive so it's much faster to open one and download 20 small items than to open and close a connection 20 times. Unfortunately the server can't tell exactly when the client is done, so all these connections are kept alive and consume resources on the server for some time.

In previous versions of Firefox, the maximum number of persistent (keep-alive) connection was set to 2. The number 2 is recommended by the HTTP 1.1 spec which says:

Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.

The spec was written in 1999 when high-speed internet connections were just (if you'll pardon the pun) a pipe dream for most users. Recently, many browsers have begin to bump the limits.  Sylvian Pasche wrote a test (which you can run here) to find out the default settings for a number of major browsers. Here's what Sylvian found:

Firefox 2: 2 Firefox 3 beta 4: 2 Opera 9.26: 4 Opera 9.5 beta: 4 Safari 3.0.4 Mac/Windows: 4 IE 7: 2 IE 8: 6

A few hours after seeing that Firefox would have the smallest default value, Mozilla developers created a patch that increased the default to the same value used by IE8: 6 persistent connections. Robert Sayre says "in my totally unscientific tests, it rocks!"

In fact most of the network connection defaults have been increased in beta 5, compared to Firefox 2. You can see them by typing "about:config" in the URL field and searching for "connect":

network.http.max-connections = 30 (was 24) network.http.max-connections-per-server = 15 (was 8) network.http.max-persistent-connections-per-proxy = 8 (was 4) network.http.max-persistent-connections-per-server = 6 (was 2)

Of course these are the default values, which a savvy user can increase if desired. However almost everyone uses the default values.

George Ou recently warned of the effect of multiple connections on network congestion. Will these higher numbers make the problem even worse once they go into widespread use?

Related articles: