lingerd – Setup and Installation

lingerd – Setup and Installation


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.

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.

The homepage for lingerd is at

The daemon itself can be found at

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 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.94.tar
4. cd lingerd-0.94
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.94/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 , and in the documentation files included in the distribution.

Similar Articles : How to install ffmpeg, ffmpeg-PHP, Mplayer, Mencoder, flv2tool, LAME MP3 Encoder, and Libog from source, How to install ffmpeg on CentOS or Redhat Enteprirse Linux the easy way (Using RPMs/Yum) , Installing Pico on FreeBSD, Turck MMCache for PHP, Apache 2 Install and Upgrade Guide, lingerd – Setup and Installation, Howto mod_rewrite with Apache, Getting started with SSH Tutorial, How to install PRM (Process Resource Monitor), How to install ionCube loader, Apache Log Files Explained, Server Loads Explained, Guide to .htaccess tutorial and tips, Optimize and Tweak High-Traffic Servers, Common SSH Commands – Linux Shell Commands, Upgrade Guide From Red Hat 7.3 to 9.0,Changing Web Hosts? Step-By-Step Guide, Customizing PHP Safe Mode, Apache 2 PHP 4 and 5 (mod_php) on Linux – Apache2 PHP4 PHP5 Installation, Fantastico Error: is protected by SourceGuardian and requires file ixed.lin.4.X.X.pxp, 4.3.7.pxp, 4.3.8.pxp, 4.3.9.pxp error, How to Copy Files Across a Network/Internet in UNIX/LINUX (Redhat, Debian, FreeBSD, etc) – scp tar rsync, Fixing rndc error in WHM/cPanel: rnd: connection failed: connection refused, wget – how to use tuturial, cPanel Awstats Fix – Stoped Logging on single domain, How to Install Zend Optimizer/Encoder on cPanel/WHM, Upgrading CentOS 3.3 to 3.4 using yum, Redhat 7.3, 8.0, and 9.0 upgrade to CentOS 3 using yum (Red hat), Tutorial/HOW-TO: Kernel 2.6 Compilation with Grsecurity (grsec) – 2.6.5, 2.6.7, 2.6.8, 2.8.1, 2.6.9, 2.6.10, , Repairing a mySQL Database/Table – How to restore/repair/recover, Flood Protection/DoS/DDoS Apache 1.3 and 2.0 – mod_dosevasive (Avoiding Denial of Service Attacks)