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

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

Summary: 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.

SHARE:
TOPICS: Browser, Servers
9

Firefox 3 beta 5 is outI 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:

Topics: Browser, Servers

Ed Burnette

About Ed Burnette

Ed Burnette is a software industry veteran with more than 25 years of experience as a programmer, author, and speaker. He has written numerous technical articles and books, most recently "Hello, Android: Introducing Google's Mobile Development Platform" from the Pragmatic Programmers.

Kick off your day with ZDNet's daily email newsletter. It's the freshest tech news and opinion, served hot. Get it.

Talkback

9 comments
Log in or register to join the discussion
  • Justified - pages are much busier now!!

    The spec is outdated relative to current usage. With large Flash objects, Ajax usage, etc. on pages these days...it is easy to have more than 2 transport connections open. In fact, it's hard not to. This should not be a problem for servers in the age of virtualization.
    Techboy_z
  • RE: Firefox 3 beta 5: How many connections is too many?

    Maybe what should happen is a conversation between the browser and server.

    If the browser could actually tell the server how many objects there will be (although the server should have some clue), the server could then decide the right approach for the current demand upon it. Light load, give them everything now. High traffic, one thing at a time.

    When such a conversation is unsupported by the browser and/or server, the current approach could be taken.
    albeit
  • RE: Firefox 3 beta 5: How many connections is too many?

    Try not to exceed 20.

    I currently have mine set at 16 and it runs great. But if you have it to high, the server gets congested and may cause error's or not load at all.


    Also, This doesn't cause server's money. Just because a connection is left open for a bit, doesn't mean any data is being sent out of the server on that connection. So when no more data is being sent, no more bandwidth is being used. Thus no more money being lost.

    Server's know to close a connection once there's no more activity on it for a bit.
    kakkoister@...
    • Not a question of money

      It's more about memory than money. A lot of research has been put into letting servers support more connections. In early servers, each connection got its own thread, but there's a limit to how many threads you can have in a process. Even if it doesn't get a whole thread, each connection has some amount of state on the server and consumes some amount of resources, which are finite. If you triple the connections, you may have the same amount of bandwidth but need more hardware to serve it.
      Ed Burnette
  • RE: Firefox 3 beta 5: many add-ons disabled

    Flashblock and AdBlockPlus, two delightful squashers of annoying ads, are disabled in beta 5, presumably because of the new security requirements for add-ons; but, I miss them & if uncorrected will affect my browser choice.
    j2cents
    • Patience

      May I be so bold as to suggest that FF3 **BETA** 5 is... uhh... Beta software.. which means not ready for release because it's meant to be a **TEST** version.. which means give the addon devs time to make needed changes?

      Honestly though, FF3b5 was just released on 4/3.. and you are already whining and complaining on 4/4 that a couple of addons aren't working with the newest **BETA** version of Firefox.
      woot@...
  • RE: Firefox 3 beta 5: How many connections is too many?

    j2cents, don't worry, it's just a matter of time before upgrades are available...chances are, if the add-ons were working on any of the betas, that people are working to get them up to snuff for b5...smaller user-base add-ons will likely upgrade once FF3 hits RTM...unless they have been abandoned.
    meetloaf13@...
  • RE : How many connections is too many?

    I note that in [b]Swiftweasel 2.0.0.13[/b], [b]stikk[/b]'s wonderful optimisation for [b]Linux[/b] distros of the latest stable [b]Firefox [/b] build, the number of connexions is set to 4, which may at least partially explain the greater responsiveness one sees with this browser....

    Henri
    mhenriday
  • that's why!

    back when i would download large amounts of large files from a single website, I would wonder why only two simultaneous downloads would take place. I wondered if it was a server setting, so I wrote a Java program that would do the same thing, and I capped the threads at 10. Sure enough, 10 files at once! But still, I didn't know why all browsers would cap it at two. Thanks :)
    Voodoo187