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.
Hi Thorsten,
> I’ll write a more detailed case-study this
> month to support spreading this heavy-load
> http-daemon.
*raises hand* Interested. :)
How did you go on about deciding how many php processes you would have running?
12:37:13
I’ll have some spare time next week. Then I’ll write some words about it.
We started with 25 PHP processes and increased them first by five, then by ten. Now we are up to about 120. I wrote a script that displays the no of PHP-request
currently being served by the server. I monitored that value using cacti, so I could determine a number of processes used under heavy load (leaving some spare ones).
But you’ll have to check with the system-load. Too many PHP-processes really slow down the system, the delivery will slow down and the number of requests awaiting service will increase.
All I can honestly say is: play around a bit …
13:07:21