PDA

View Full Version : How to solve the problem with server which have many php-cgi process?


tnctstuvn1981
4th November 2011, 05:19
Hi All
I have a web hosting server and I get problem as there're too much php-cgi process on abc.com website which running on this server.
#top -c
top - 11:26:09 up 72 days, 1:25, 1 user, load average: 24.28, 18.63, 12.34
Tasks: 530 total, 3 running, 523 sleeping, 0 stopped, 4 zombie
Cpu(s): 34.4%us, 65.2%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 12298068k total, 11151636k used, 1146432k free, 512372k buffers
Swap: 4192956k total, 108k used, 4192848k free, 5576728k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7337 mysql 15 0 1633m 878m 4556 S 357.2 7.3 367:35.89 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/m
3426 root 34 19 962m 726m 2108 S 0.0 6.0 2:11.29 /usr/bin/python -tt /usr/sbin/yum-updatesd
2845 clamav 15 0 242m 121m 1628 S 0.0 1.0 4:40.60 clamd
12878 amavis 15 0 299m 103m 3548 S 0.0 0.9 0:01.32 amavisd (ch8-avail)
14211 amavis 15 0 298m 102m 3172 S 0.0 0.9 0:00.26 amavisd (ch1-avail)
3112 amavis 15 0 296m 100m 2676 S 0.0 0.8 0:14.20 amavisd (master)
3015 root 15 0 210m 61m 3032 S 0.0 0.5 0:04.38 /usr/bin/spamd -d -c -m5 -H -r /var/run/spamd.pid
3074 root 15 0 210m 58m 712 S 0.0 0.5 0:04.14 spamd child
3075 root 18 0 210m 58m 624 S 0.0 0.5 0:04.28 spamd child
8381 web19 25 0 181m 44m 4932 R 26.3 0.4 0:40.79 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client14/web19/web:/var/www/clients/client14/w
13724 apache 15 0 267m 33m 4500 S 0.0 0.3 0:00.37 /usr/sbin/httpd
2142 web20 15 0 114m 32m 5396 S 0.0 0.3 0:56.95 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
12472 apache 15 0 266m 32m 4552 S 0.0 0.3 0:00.30 /usr/sbin/httpd
25402 web20 15 0 104m 22m 5100 S 0.0 0.2 0:03.15 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14626 web20 16 0 104m 22m 4844 S 0.0 0.2 0:00.34 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14744 web20 15 0 104m 22m 4868 S 0.0 0.2 0:00.52 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14452 web20 15 0 104m 22m 4876 S 0.0 0.2 0:00.49 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14448 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.31 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14466 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.32 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14787 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.29 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14792 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.30 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14793 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.28 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14801 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.29 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14454 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.26 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14490 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.31 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14557 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.28 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14786 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.32 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14800 web20 15 0 104m 22m 4844 S 0.0 0.2 0:00.32 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
6300 web20 15 0 103m 21m 5928 S 0.0 0.2 0:53.57 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
6536 web20 15 0 154m 21m 5048 S 0.0 0.2 0:01.52 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
6232 web20 16 0 102m 20m 5564 S 0.0 0.2 2:35.23 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14828 web20 16 0 101m 20m 4844 S 0.0 0.2 0:00.28 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
6382 web20 16 0 100m 20m 5208 S 0.0 0.2 0:32.75 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
25238 web20 15 0 100m 20m 5328 S 0.0 0.2 0:34.60 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14556 web20 15 0 153m 20m 5064 S 0.0 0.2 0:00.71 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
24968 web20 16 0 101m 20m 5552 S 0.0 0.2 0:11.49 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
2040 web20 15 0 101m 19m 5284 S 0.0 0.2 0:16.99 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
25233 web20 15 0 101m 19m 5564 S 0.0 0.2 0:27.87 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w
14939 web20 15 0 101m 19m 5604 S 0.0 0.2 0:00.68 /usr/bin/php-cgi -d open_basedir=/var/www/clients/client16/web20/web:/var/www/clients/client16/w

# ps -A | grep php-cgi | wc -l
157
#


Config website abc.com on ispconfig 3 run fastcgi.
<IfModule mod_fcgid.c>
# SocketPath /tmp/fcgid_sock/
IdleTimeout 3600
ProcessLifeTime 7200
# MaxProcessCount 1000
DefaultMinClassProcessCount 3
DefaultMaxClassProcessCount 100
IPCConnectTimeout 8
IPCCommTimeout 360
BusyTimeout 300
</IfModule>

Log error apache

[Fri Nov 04 10:37:10 2011] [warn] mod_fcgid: process 30273 graceful kill fail, sending SIGKILL
[Fri Nov 04 10:40:10 2011] [warn] mod_fcgid: process 31608 graceful kill fail, sending SIGKILL
[Fri Nov 04 10:43:13 2011] [warn] mod_fcgid: process 32488 graceful kill fail, sending SIGKILL
[Fri Nov 04 10:46:25 2011] [warn] mod_fcgid: process 1615 graceful kill fail, sending SIGKILL
[Fri Nov 04 10:49:25 2011] [warn] mod_fcgid: process 1793 graceful kill fail, sending SIGKILL
[Fri Nov 04 10:52:24 2011] [warn] mod_fcgid: process 2557 graceful kill fail, sending SIGKILL
[Fri Nov 04 10:55:27 2011] [warn] mod_fcgid: process 2558 graceful kill fail, sending SIGKILL
[Fri Nov 04 10:58:35 2011] [warn] mod_fcgid: process 4473 graceful kill fail, sending SIGKILL
[Fri Nov 04 11:01:47 2011] [warn] mod_fcgid: process 5675 graceful kill fail, sending SIGKILL
[Fri Nov 04 11:05:16 2011] [warn] mod_fcgid: process 6854 graceful kill fail, sending SIGKILL

Please help.
Thanks.

till
4th November 2011, 09:29
Where is the exact problem? Having these php-cgi processes is absolutely ok.

pititis
6th November 2011, 01:19
it's normal with these values. By default idletimeout is 300 (5 min) you have 1 hour. Check the fastcgi documentation

httpd.apache.org/mod_fcgid/mod/mod_fcgid.html