WHAT IS LINGERD?
Under high load, a dynamic page server running Apache with mod_php
spends a lot of its time doing an operation called “lingering
close”, which amounts to waiting a second or two on a connection
just to make sure it gets closed properly.
Lingerd, then, is a daemon (service) designed to take over this job.
Unlike Apache, which uses one process per connection, lingerd can do
thousands of lingers in parallel, from a single process. The end
result is that Apache needs much fewer running processes to handle
the same load, which greatly increases its scalability, and
diminishes the load on the server.
For technical reasons, lingerd is only effective on servers where
keep-alives are disabled. To get the most out of your servers, for
a high traffic site, you need to have the dynamic webpages served
from one Apache server, and the images and other static data from
another. The dynamic page server can then use lingerd.
HOW STABLE IS IT?
Lingerd has been in production use for a few months, and has
lingered nearly 2,000,000 connections with no errors, under Linux.
More testing is still needed under other platforms (eg BSD,
Solaris). Lingerd is not portable to Windows.
WHERE DO I FIND IT?
The homepage for lingerd is at
http://www.iagora.com/about/software/lingerd/
The daemon itself can be found at
ftp://iagora.com/pub/software/lingerd/lingerd-0.93.tar.gz
HOW DO I USE IT?
Installing lingerd is fairly simple, but it does require recompiling
Apache from source.
Here are some quick installation instructions for Apache with
mod_php and lingerd (see
https://phpbuilder.com/manual/install-unix.php for more details),
under Unix or Linux:
1. tar zxvf apache_1.3.x.tar.gz 2. tar zxvf php-3.0.x.tar 3. tar zxvf lingerd-0.93.tar 4. cd lingerd-0.93 5. vi config.h (set the right directories for SOCKPATH and PID_FILE; these directories must be writeable by the userid that Apache runs as) 6. vi apache-1.3/ap_lingerd.h (set SOCKPATH here too) 7. make ; make install (also set the system up to start lingerd automatically, e.g by adding the line "/usr/local/sbin/lingerd" to your /etc/rc.d/rc.local file) 8. cp apache-1.3/ap_lingerd.* ../apache_1.3.x/src/main/ 9. cd ../apache_1.3.x 10. patch -p0 -d src/ < ../lingerd-0.93/apache-1.3/aplinger.diff 11. ./configure --prefix=/www 12. cd ../php-3.0.x 13. ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars 14. make ; make install 15. cd ../apache_1.3.x 16. ./configure --prefix=/www --activate-module=src/modules/php3/libphp3.a 17. make ; make install
To see if lingerd is running, and how many connections it has been
handling, watch out for its messages in /var/log/messages.
Lingerd is not tightly tied to the dynamic programming language, so
it can be used with PHP3, PHP4, and also with other scripting
engines like mod_perl, mod_snake or mod_dtcl.
You can find more information about lingerd in its homepage at http://www.iagora.com/about/software/lingerd/ , and in the documentation files included in the distribution.