Last week I switched the websites whose servers I administer from Apache to Lighttpd 1.3.13. The servers ran under really heavy load (about 100 on single-processor x86 machines). The reasons fpr choosing an innovative solution like lighttpd over somethin like mod_backhand were as follows:
- lighttpd has a very small memory footprint. Though we are running on 2 gigs of RAM, the mysql-databases had to swap a lot. Now there’s nearly no more swapping
- Load-balancing with FastCGI. Now it’ll be easy to integrate more hardware just running PHP-FastCGI-processes
- It’s a matter of seconds to compile a current version of PHP for use as FastCGI (it’s easier than compiling it into apache)
- lighttpd is two times as fast in serving static pages and pictures. Those are about 50% of the served content.
The switching process was kind of hard during to the fact that lighttpd does not read .htaccess – files. So all access restricted areas had to be transformed into the lighttpd configuration file. After switching the server load dropped dramatically on both machines (from about 20 to 4). Now, with more visitors attracted by the website, the load has gone up to 8 to 9 again.
The load corresponds directly to the number of spawned FastCGI PHP processes. I started with 15 simultaneous processes, went up to 140 and am now at about 80 per machine: Many processes not serving content comsume way too much system load.
I’ll write a more detailed case-study this month to support spreading this heavy-load http-daemon.