
Here are some tools to test lingerd's effectiveness, and to measure
lingering_close's impact on an Apache server.

* The Scoreboard Patch

This patch adds a flag to the /server-status module so that it shows
Apache processes that are currently doing a lingering close.  The flag
letter for lingering close is '@'.

There are two versions of the patch; "scoreboard.diff" is the one for a
lingerd-enabled Apache (i.e it requires the lingerd patch to be applied
first), and "scoreboard-nolingerd.diff" is the one for a plain Apache.

Please apply the patches in this order; if you apply
"scoreboard-nolingerd.diff" first, and then the lingerd patch, you could
get strange results.

To patch and compile:

  cd $APACHE/src/
  patch -p0 < $LINGERD/testing/scoreboard.diff (or scoreboard-nolingerd.diff)
  cd ..
  ./configure --enable-module=status --whatever-else
  make

Make sure you enable mod_status in httpd.conf; put some load on the
server, including badly behaved clients that don't close their sockets
immediately (see below), and watch the results at
http://your.server/server-status.

This patch is simple enough that it really should be safe to run it on a
production server, to see the effects of lingering on a real load.  I
still recommend some testing first, though.


* The Apache Lingering Benchmark

ablinger is a copy of ab (Apache Benchmark, from the Apache
distribution, in /support/ab.c), modified to delay closing its sockets.

This simulates the behavior of buggy browsers like Netscape and IE,
which keep network connections open in the face of a server EOF, and
plain slow clients which take a while to get that EOF.

Sockets are held open in a cyclical way. There is no timeout to close
them; the program just stores open sockets in a list, and when the list
is full, starts closing the old ones.  So the amount of time that
connections are held for actually depends on the length of this list, on
the speed of the server, on the delay between connections, and on the
connection concurrency.

To compile ablinger, type "make" in the testing directory.

The new options are:
     -l  : number of lingering connections to keep open
     -s  : number of milliseconds to delay between connections

And the old ones:
     -n  : number of connections to make, total
     -c  : number of concurrent connections to make

Try it with options like this:

./ablinger -l 500 -s 50 -n 300 -c 3 http://your.server/

While this runs, and with the scoreboard patch applied, watch the
state of your server at http://your-server/server-status

