Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So my lighttpd was running fine for more than a year. Two days ago I decided to install Wordpress 3.0.1 (PHP was already in use by other tools).

So after some hours of very few hits (i might get 10 unique visitors per day at max), the system almost hangs with a load of 25-35, lighttpd eating all CPU and RAM (see top at the end of the post).

I read of similar problems, but none seemed to be exactly what occurs here. The "solutions" on the web were like installing a Wordpress Caching Plugin, which i did (W3 Total Cache). As the problem didn't occur during the night, I thought that was the problem. But right now the machine is totally overloaded, even OOM Killer is kicking in.

A lighttpd restart helps, but that's not a real solution.

System specs:

  • Intel Celeron2Duo 2.2GHz
  • 4GB RAM
  • Debian Lenny 5.0.6
  • Kernel: 2.6.26-2-amd64
  • lighttpd 1.4.19
  • MySQL 5.0.51a
  • PHP 5.2.6-1+lenny

Changing the hardware is no option, as it's a home server made for low power consumption. Ideas? Thanks in advance.

top - 10:34:04 up 19:03,  1 user,  load average: 25.98, 22.97, 12.51
Tasks: 155 total,  15 running, 140 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.5%us, 95.6%sy,  0.0%ni,  0.0%id,  3.6%wa,  0.0%hi,  0.3%si,  0.0%st
Mem:   4062488k total,  4039436k used,    23052k free,      264k buffers
Swap:   979956k total,   979956k used,        0k free,     3012k cached
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                     
 3648 debian-t  20   0  136m 6972  116 R    7  0.2  30:48.27 transmission-da                              
 2569 root      20   0  196m  900  108 S    5  0.0   4:51.94 rsyslogd                                     
  316 munin     20   0 30592  548  136 D    4  0.0   0:04.68 sendmail                                     
 3377 root      20   0 66292 6864  208 D    4  0.2   2:01.44 python                                       
 3188 www-data  20   0 4074m 3.1g  124 R    4 81.2  12:20.23 lighttpd

Edit: I installed a temporary restart script as suggested by LatinSuD. So probably tomorrow I can tell details about the interval of that issue.

share|improve this question
1  
Until the bug is found and solved i suggest to create a script to monitor mem usage and restart lighthttpd whenver it grows too much. –  LatinSuD Oct 14 '10 at 9:43
    
Good idea. Can you confirm this is a bug? –  weeheavy Oct 14 '10 at 9:50
add comment

2 Answers

up vote 1 down vote accepted

Can you update to a newer version of lighttpd? 1.4.19 is very old (the newest 1.4 branch is 1.4.28). I know there have been a number of memory leaks fixed in that interval.

http://redmine.lighttpd.net/projects/lighttpd/repository/entry/branches/lighttpd-1.4.x/NEWS

How do you have php installed? If you're using fastcgi, do you have too many worker processes starting? Make sure you haven't done something problematic with mod_rewrite that's causing an endless loop. Normally lighttpd detects those, but Bug 1775 was fixed in 1.4.20, and might be your issue.

share|improve this answer
    
I started using mod_rewrite in the same time I installed Wordpress, so it might exactly be that bug 1775. Unfortunately I switched to Apache (I'm no fan of it) because even the workaround with the restart script wouldn't help. But I'll try lighttpd 1.4.28 from Debian testing. Thanks very much! –  weeheavy Oct 20 '10 at 7:11
    
Good luck! Glad to be of help. –  Paul McMillan Oct 20 '10 at 16:59
add comment

I'm running lighttpd on a TonidoPlug, so it's vital for me to watch memory consumption. To that end, I've cron'd the following script to run every 30 minutes. There's probably a better way to do it, but it works for me :-)

echo `date +'%Y%m%d %H%M'`,`free | grep "Mem" | sed -e 's/ \{1,\}/,/g' | sed -e 's/^Mem:.//g'` | cut -d',' -f1,3,4,6,7 >> memorywatch.dat

The column headers are: "datetime,used,free,buffers,cached" and the output records look like this: 20110613 1002,184716,329092,30548,129496

You can then import the file into Excel/OpenOffice at regular intervals to produce graphs.

In my case, I run a "sync && echo 3 > /proc/sys/vm/drop_caches" on a regular basis - hence the "heartbeat" style graph above. It's a work in progress and I'm making further tweaks.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.