Project

General

Profile

Actions

Bug #2395

closed

Very high CPU usage lighttpd 1.4.28/29/30/31-devel

Added by marek about 12 years ago. Updated about 12 years ago.

Status:
Invalid
Priority:
Normal
Category:
-
Target version:
-
ASK QUESTIONS IN Forums:

Description

This is really annoying:

Without cron scheduler enabled it looks like this:

top - 19:01:04 up  1:19,  4 users,  load average: 15.75, 13.76, 12.51
Tasks: 387 total,  15 running, 303 sleeping,   0 stopped,  69 zombie
Cpu(s): 40.0%us, 58.2%sy,  0.0%ni,  0.3%id,  0.4%wa,  0.1%hi,  0.8%si,  0.0%st
Mem:  16371016k total, 16231396k used,   139620k free,  1502892k buffers
Swap:  8388600k total,        0k used,  8388600k free,  8430204k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 4347 mysql     15   0 4489m 1.7g 5860 S 93.7 10.6  20:49.26 mysqld
 6464 apache    25   0  347m 206m  936 R 61.0  1.3  31:28.61 lighttpd
 6462 apache    25   0  347m 195m  936 R 58.3  1.2  29:05.13 lighttpd
 6463 apache    25   0  347m 206m  980 R 57.9  1.3  30:00.73 lighttpd
16169 agona2    25   0 98.5m  19m 5236 R 30.3  0.1   0:00.77 php-cgi
16135 admin     25   0     0    0    0 Z 27.6  0.0   0:00.70 php-cgi <defunct>
16150 mario271  24   0     0    0    0 Z 27.6  0.0   0:00.70 php-cgi <defunct>
31764 root      18   0 1188m 1.1g 4632 R 26.8  7.4  26:47.32 lphp.exe
16146 magdusie  24   0  363m  31m  12m R 23.2  0.2   0:00.59 php-cgi
16171 spokozio  25   0     0    0    0 Z 23.2  0.0   0:00.59 php-cgi <defunct>
16086 dazir     21   0     0    0    0 Z 22.0  0.0   0:00.70 php-cgi <defunct>
16153 rafaltra  25   0     0    0    0 R 21.7  0.0   0:00.55 php-cgi
16121 wojadann  25   0     0    0    0 Z 20.5  0.0   0:00.52 php-cgi <defunct>
16085 monia_ma  18   0     0    0    0 Z 20.1  0.0   0:00.70 php-cgi <defunct>
16106 dazir     16   0  370m  39m  13m S 18.5  0.2   0:00.60 php-cgi
16070 spokozio  25   0     0    0    0 Z 18.1  0.0   0:00.57 php-cgi <defunct>
16068 besthurt  16   0     0    0    0 Z 17.3  0.0   0:00.84 php-cgi <defunct>
16181 admin     25   0  360m  30m  13m R 16.5  0.2   0:00.42 php-cgi
16199 dazir     25   0  361m  32m  12m S 16.1  0.2   0:00.41 php-cgi
16044 mojasilo  25   0     0    0    0 Z 14.6  0.0   0:00.69 php-cgi <defunct>
16152 fhu_sun  25   0  352m  22m  11m R 14.6  0.1   0:00.37 php-cgi
16071 admin     25   0     0    0    0 Z 13.4  0.0   0:00.82 php-cgi <defunct>
16039 zootechn  17   0     0    0    0 Z 11.8  0.0   0:00.89 php-cgi <defunct>
16080 fhu_sun  24   0     0    0    0 Z  8.7  0.0   0:00.59 php-cgi <defunct>
16074 fhu_sun  25   0     0    0    0 Z  7.9  0.0   0:00.46 php-cgi <defunct>
16056 eline2    22   0     0    0    0 Z  6.7  0.0   0:00.79 php-cgi <defunct>
15996 admin     17   0     0    0    0 Z  6.3  0.0   0:01.09 php-cgi <defunct>
16201 root      17   0 27676  13m 4140 S  4.7  0.1   0:00.12 php
16211 spokozio  25   0  151m 4772 3408 R  4.7  0.0   0:00.12 php-cgi
16053 smerfetk  15   0     0    0    0 Z  3.5  0.0   0:00.71 php-cgi <defunct>
16054 dazir     23   0     0    0    0 Z  3.1  0.0   0:00.77 php-cgi <defunct>
16213 apache    25   0     8    4    0 R  3.1  0.0   0:00.08 lighttpd
 7428 root      15   0 13016 1368  820 R  2.8  0.0   0:02.37 top
16016 admin     17   0     0    0    0 Z  2.0  0.0   0:00.86 php-cgi <defunct>
 4774 varnish   18   0 12.3g 380m  81m S  0.8  2.4   2:16.94 varnishd
 5908 memcache  15   0  143m  77m  404 S  0.8  0.5   0:13.70 memcached
 2179 root      10  -5     0    0    0 S  0.4  0.0   0:02.41 md2_raid1
 3535 named     24   0  340m  61m 2592 S  0.4  0.4   0:35.41 named
 4569 lxlabs    15   0 66468 7472 1484 S  0.4  0.0   0:03.89 kloxo.httpd
 7848 matiowip  15   0  116m 3300 2560 S  0.4  0.0   0:00.45 pure-ftpd

With cron jobs it's even worse:

top - 22:21:13 up 67 days, 10:28,  1 user,  load average: 25.13, 23.18, 21.14
Tasks: 579 total,  48 running, 457 sleeping,   0 stopped,  74 zombie
Cpu(s):  0.2%us, 80.3%sy, 19.2%ni,  0.0%id,  0.0%wa,  0.1%hi,  0.2%si,  0.0%st
Mem:  16378256k total, 16216396k used,   161860k free,   541292k buffers
Swap:  8388600k total,   735000k used,  7653600k free,  4689408k cached

Logs:

2012-03-06 19:24:05: (log.c.166) server started
2012-03-06 19:24:42: (mod_rewrite.c.380) execution error while matching:  -8
2012-03-06 19:40:30: (mod_rewrite.c.380) execution error while matching:  -8
2012-03-06 19:54:04: (mod_rewrite.c.380) execution error while matching:  -8
2012-03-06 19:59:47: (mod_rewrite.c.380) execution error while matching:  -8

My config:

server.max-worker = 3
server.event-handler = "linux-sysepoll" 
server.network-backend = "linux-sendfile" 
server.max-connections = 1000
server.stat-cache-engine = "simple" 
server.max-fds = 10000
server.max-keep-alive-idle = 0
#server.max-keep-alive-requests = 0
server.max-read-idle = 10
server.max-write-idle = 30
server.max-request-size = 40960
server.follow-symlink="enable" 

CentOS 5.7 64-bit on Intel Core i7 2600 3.4 GHz + 16 GB DDR3 RAM

Actions #1

Updated by marek about 12 years ago

Kernel: 2.6.18-274.18.1.el5 #1 SMP Thu Feb 9 12:45:44 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

Actions #2

Updated by darix about 12 years ago

  • Priority changed from Urgent to Normal
  1. one of your rewrite rules is running amok.
  2. why is there more than one lighty process?
  3. your php processes seems to die aswell (defunct processes)
Actions #3

Updated by marek about 12 years ago

I've made a benchmark right now and take a look at results:

Varnish + Lighttpd: Requests per second: 4.53 [#/sec] (mean) ???
Lighttpd: Requests per second: 4.71 [#/sec] (mean)
Apache: Requests per second: 229.80 [#/sec] (mean)

All were taken on the same machine with the same PHP (5.3.10).

Actions #4

Updated by marek about 12 years ago

darix wrote:

  1. why is there more than one lighty process?

I use server.max-worker = 3

But there seems to be even 4 processes:

apache   13416  0.5  0.5 179152 92056 ?        S    23:18   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
apache   13473 26.4  0.9 346972 153608 ?       S    23:18   0:24 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
apache   13474 27.4  0.8 346972 146600 ?       S    23:18   0:25 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
apache   13475 36.5  1.0 347104 164352 ?       S    23:18   0:34 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
Actions #5

Updated by stbuehler about 12 years ago

  • Status changed from New to Invalid
  • Target version deleted (1.4.31)
  • I can't see any config
  • No lighttpd version
  • Broken php setup
  • No support for server.max-worker != 1
  • As darix pointed out, you probably have broken rewrite rules.
Actions

Also available in: Atom