Current time: 12-24-2024, 04:02 AM Hello There, Guest! (LoginRegister)


Post Reply 
Sometimes php5 process stress cpu
Author Message
Lordek Offline
Junior Member
*

Posts: 22
Joined: May 2008
Reputation: 0
Post: #1
Sometimes php5 process stress cpu
Sometimes in some oscommerce websites the php5 process takes the 90% CPU indefinitely.

When i watch the processes with ps aux or htop i can only see the /usr/bin/php5 but not the .php file that cause this overload.

How can i see wich scripts are doing this?
(This post was last modified: 07-22-2008 08:21 AM by Lordek.)
07-22-2008 08:20 AM
Find all posts by this user Quote this message in a reply
bulforce Offline
Junior Member
*

Posts: 63
Joined: Oct 2007
Reputation: 0
Post: #2
RE: Sometimes php5 process stress cpu
i host around 15 blog sites... all using wordpress

What i notice is that every once in a while (lets say couple of days) the server get under very high cpu load... average CPU 70~80%

with "top" i can see a lot of php5-cgi processes and some of them shows [defunct]. I am kind of new to linux and so far the only way to fix this is to write killall php5-cgi which is helping for a while but then its happening again.

Can somebody tell me how can see which php file exactly is causing this high load, so i can dig into that issue... i mean some freak "ps dsuaby | grep -dkjsahu" command maybe.

System infomation
Pentium 4 3GHz
1GB ram
100 MBps uplink

Debian 4.0
ispCP 1.0.0 RC4 OMEGA
build: 20080308
Priamos

Thank you
07-22-2008 02:09 PM
Find all posts by this user Quote this message in a reply
Lordek Offline
Junior Member
*

Posts: 22
Joined: May 2008
Reputation: 0
Post: #3
RE: Sometimes php5 process stress cpu
any idea?
07-28-2008 08:40 AM
Find all posts by this user Quote this message in a reply
Lordek Offline
Junior Member
*

Posts: 22
Joined: May 2008
Reputation: 0
Post: #4
RE: Sometimes php5 process stress cpu
Hi!

bulforce try with "lsof | grep PID" where PID is the process id of php5 process you want to track
(This post was last modified: 08-05-2008 05:56 AM by Lordek.)
08-05-2008 05:55 AM
Find all posts by this user Quote this message in a reply
BioALIEN Offline
Public Relations Officer
*****
Dev Team

Posts: 620
Joined: Feb 2007
Reputation: 5
Post: #5
RE: Sometimes php5 process stress cpu
This is a well documented issue with php5. I think it should be fixed in php5.2.6 so update/upgrade your packages.

Search the forum for similar topics as this has been discussed with solutions being proposed.
08-06-2008 12:30 PM
Find all posts by this user Quote this message in a reply
gutek Offline
Junior Member
*

Posts: 11
Joined: May 2008
Reputation: 0
Post: #6
RE: Sometimes php5 process stress cpu
i have the same problem.

lsof:
Code:
php5-cgi  11501   vu2006  cwd       DIR        8,9      4096    1114121 /var/www/fcgi/hej.org
php5-cgi  11501   vu2006  rtd       DIR        8,1      1024          2 /
php5-cgi  11501   vu2006  txt       REG        8,2   5174028     197129 /usr/bin/php5-cgi
php5-cgi  11501   vu2006  mem       REG        0,0                    0 [heap] (stat: No such file or directory)
php5-cgi  11501   vu2006  mem       REG        8,1     38372      48345 /lib/tls/i686/cmov/libnss_files-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,2    125600     180394 /usr/lib/php5/20060613+lfs/suhosin.so
php5-cgi  11501   vu2006  mem       REG        8,2     95048     180393 /usr/lib/php5/20060613+lfs/pgsql.so
php5-cgi  11501   vu2006  mem       REG        8,2    119408     164362 /usr/lib/libpq.so.4.1
php5-cgi  11501   vu2006  mem       REG        8,2     22636     180392 /usr/lib/php5/20060613+lfs/pdo_pgsql.so
php5-cgi  11501   vu2006  mem       REG        8,2     23556     180391 /usr/lib/php5/20060613+lfs/pdo_mysql.so
php5-cgi  11501   vu2006  mem       REG        8,2     80496     180390 /usr/lib/php5/20060613+lfs/pdo.so
php5-cgi  11501   vu2006  mem       REG        8,2     98352     180389 /usr/lib/php5/20060613+lfs/mysqli.so
php5-cgi  11501   vu2006  mem       REG        8,2   1933648     164302 /usr/lib/libmysqlclient.so.15.0.0
php5-cgi  11501   vu2006  mem       REG        8,2     44904     180388 /usr/lib/php5/20060613+lfs/mysql.so
php5-cgi  11501   vu2006  mem       REG        8,2     27492     164384 /usr/lib/libungif.so.4.1.4
php5-cgi  11501   vu2006  mem       REG        8,2    281944     164300 /usr/lib/libming.so.0.3.0
php5-cgi  11501   vu2006  mem       REG        8,2    101836     180387 /usr/lib/php5/20060613+lfs/ming.so
php5-cgi  11501   vu2006  mem       REG        8,2    293632     164299 /usr/lib/libmhash.so.2.0.0
php5-cgi  11501   vu2006  mem       REG        8,2     23520     164287 /usr/lib/libltdl.so.3.1.4
php5-cgi  11501   vu2006  mem       REG        8,2    162672     164295 /usr/lib/libmcrypt.so.4.4.7
php5-cgi  11501   vu2006  mem       REG        8,2     31464     180385 /usr/lib/php5/20060613+lfs/mcrypt.so
php5-cgi  11501   vu2006  mem       REG        8,1     29700      48350 /lib/libpam.so.0.79
php5-cgi  11501   vu2006  mem       REG        8,2    772960     164227 /usr/lib/libc-client.so.2002edebian.1
php5-cgi  11501   vu2006  mem       REG        8,2     90136     180384 /usr/lib/php5/20060613+lfs/imap.so
php5-cgi  11501   vu2006  mem       REG        8,2    126624     164245 /usr/lib/libexpat.so.1.0.0
php5-cgi  11501   vu2006  mem       REG        8,2     16672     164213 /usr/lib/libXdmcp.so.6.0.0
php5-cgi  11501   vu2006  mem       REG        8,2      7220     164212 /usr/lib/libXau.so.6.0.0
php5-cgi  11501   vu2006  mem       REG        8,2    176036     164247 /usr/lib/libfontconfig.so.1.2.0
php5-cgi  11501   vu2006  mem       REG        8,1     89370      48353 /lib/tls/i686/cmov/libpthread-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,2    127488     164278 /usr/lib/libjpeg.so.62.0.0
php5-cgi  11501   vu2006  mem       REG        8,2    137760     164356 /usr/lib/libpng12.so.0.15.0
php5-cgi  11501   vu2006  mem       REG        8,2     60956     164215 /usr/lib/libXpm.so.4.11.0
php5-cgi  11501   vu2006  mem       REG        8,2    965952     164211 /usr/lib/libX11.so.6.2.0
php5-cgi  11501   vu2006  mem       REG        8,2    434840     164251 /usr/lib/libfreetype.so.6.3.10
php5-cgi  11501   vu2006  mem       REG        8,2    253372     164380 /usr/lib/libt1.so.5.1.0
php5-cgi  11501   vu2006  mem       REG        8,2    243480     165947 /usr/lib/libgd.so.2.0.33
php5-cgi  11501   vu2006  mem       REG        8,2    101984     180382 /usr/lib/php5/20060613+lfs/gd.so
php5-cgi  11501   vu2006  mem       REG        8,2    196128     164272 /usr/lib/libidn.so.11.5.19
php5-cgi  11501   vu2006  mem       REG        8,2    212988     164235 /usr/lib/libcurl.so.3.0.0
php5-cgi  11501   vu2006  mem       REG        8,2     57096     180380 /usr/lib/php5/20060613+lfs/curl.so
php5-cgi  11501   vu2006  mem       REG        8,9    982084    1294578 /var/www/virtual/hej.org/ioncube/ioncube_loader_lin_5.2.so
php5-cgi  11501   vu2006  mem       REG        8,2     14504     164616 /usr/lib/libkrb5support.so.0.0
php5-cgi  11501   vu2006  mem       REG        8,2   1270520     164815 /usr/lib/i686/cmov/libcrypto.so.0.9.8
php5-cgi  11501   vu2006  mem       REG        8,1   1241392      48320 /lib/tls/i686/cmov/libc-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,2   1147196     164386 /usr/lib/libxml2.so.2.6.27
php5-cgi  11501   vu2006  mem       REG        8,1      5820      48329 /lib/libcom_err.so.2.1
php5-cgi  11501   vu2006  mem       REG        8,2    151252     164613 /usr/lib/libk5crypto.so.3.0
php5-cgi  11501   vu2006  mem       REG        8,2    508328     164615 /usr/lib/libkrb5.so.3.2
php5-cgi  11501   vu2006  mem       REG        8,2    111708     164612 /usr/lib/libgssapi_krb5.so.2.2
php5-cgi  11501   vu2006  mem       REG        8,1     76548      48340 /lib/tls/i686/cmov/libnsl-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,1      9592      48331 /lib/tls/i686/cmov/libdl-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,1    145136      48334 /lib/tls/i686/cmov/libm-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,1     67364      48356 /lib/tls/i686/cmov/libresolv-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,1     66200      48324 /lib/libbz2.so.1.0.3
php5-cgi  11501   vu2006  mem       REG        8,2   1023476     164238 /usr/lib/libdb-4.4.so
php5-cgi  11501   vu2006  mem       REG        8,2    151564     164353 /usr/lib/libpcre.so.3.12.0
php5-cgi  11501   vu2006  mem       REG        8,2    253120     164816 /usr/lib/i686/cmov/libssl.so.0.9.8
php5-cgi  11501   vu2006  mem       REG        8,2     78500     164388 /usr/lib/libz.so.1.2.3
php5-cgi  11501   vu2006  mem       REG        8,1     21868      48328 /lib/tls/i686/cmov/libcrypt-2.3.6.so
php5-cgi  11501   vu2006  mem       REG        8,2      7160     180386 /usr/lib/php5/20060613+lfs/mhash.so
php5-cgi  11501   vu2006  mem       REG        8,1     88164      48609 /lib/ld-2.3.6.so
php5-cgi  11501   vu2006    0u     unix 0xdd63ae40             22442966 /var/lib/apache2/fastcgi2/dynamic/98d006db49362202792ba2b121d6b38a
php5-cgi  11501   vu2006    1w      REG        8,7   1080595     211992 /var/log/apache2/error.log
php5-cgi  11501   vu2006    2w      REG        8,7   1080595     211992 /var/log/apache2/error.log


and strace:
Code:
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb78ce708) = 3146
[pid  3146] rt_sigaction(SIGTERM, {0x83203f0, [], 0}, NULL, 8) = 0
[pid  3146] rt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0
[pid  3146] rt_sigaction(SIGINT, {SIG_DFL}, NULL, 8) = 0
[pid  3146] munmap(0xb7038000, 98196)   = 0
[pid  3146] munmap(0xb706d000, 21572)   = 0
[pid  3146] munmap(0xb7050000, 118380)  = 0
[pid  3146] munmap(0xb7073000, 26532)   = 0
[pid  3146] munmap(0xb707a000, 79932)   = 0
[pid  3146] munmap(0xb708e000, 102048)  = 0
[pid  3146] munmap(0xb7281000, 48032)   = 0
[pid  3146] munmap(0xb70a7000, 1940224) = 0
[pid  3146] munmap(0xb72dd000, 104996)  = 0
[pid  3146] munmap(0xb7295000, 293584)  = 0
[pid  3146] munmap(0xb728d000, 30512)   = 0
[pid  3146] munmap(0xb7f23000, 10172)   = 0
[pid  3146] munmap(0xb72f7000, 292496)  = 0
[pid  3146] munmap(0xb7379000, 34492)   = 0
[pid  3146] munmap(0xb734b000, 184704)  = 0
[pid  3146] munmap(0xb7344000, 26584)   = 0
[pid  3146] munmap(0xb7448000, 93280)   = 0
[pid  3146] munmap(0xb738a000, 777552)  = 0
[pid  3146] munmap(0xb7382000, 32656)   = 0
[pid  3146] munmap(0xb7710000, 105012)  = 0
[pid  3146] munmap(0xb76c0000, 325144)  = 0
[pid  3146] munmap(0xb766d000, 338392)  = 0
[pid  3146] munmap(0xb7487000, 175460)  = 0
[pid  3146] munmap(0xb7603000, 433700)  = 0
[pid  3146] munmap(0xb7507000, 63836)   = 0
[pid  3146] munmap(0xb7517000, 966364)  = 0
[pid  3146] munmap(0xb74e4000, 140716)  = 0
[pid  3146] munmap(0xb74c4000, 130444)  = 0
[pid  3146] munmap(0xb7484000, 10164)   = 0
[pid  3146] munmap(0xb747f000, 19604)   = 0
[pid  3146] munmap(0xb745f000, 129528)  = 0
[pid  3146] munmap(0xb778f000, 56020 <unfinished ...>
[pid 11501] --- SIGCHLD (Child exited) @ 0 (0) ---
[pid 11501] wait4(-1, Process 11501 suspended
<unfinished ...>
[pid  3146] <... munmap resumed> )      = 0
[pid  3146] munmap(0xb775a000, 216316)  = 0
[pid  3146] munmap(0xb772a000, 194988)  = 0
[pid  3146] munmap(0xb779d000, 981648)  = 0
[pid  3146] munmap(0xb7018000, 129224)  = 0
[pid  3146] exit_group(0)               = ?
Process 11501 resumed
Process 3146 detached
<... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3145
clone(Process 3147 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb78ce708) = 3147
[pid  3147] rt_sigaction(SIGTERM, {0x83203f0, [], 0}, NULL, 8) = 0
[pid  3147] rt_sigaction(SIGQUIT, {SIG_DFL}, NULL, 8) = 0
[pid  3147] rt_sigaction(SIGINT, {SIG_DFL}, NULL, 8) = 0
[pid  3147] munmap(0xb7038000, 98196)   = 0
[pid  3147] munmap(0xb706d000, 21572)   = 0
[pid  3147] munmap(0xb7050000, 118380)  = 0
[pid  3147] munmap(0xb7073000, 26532)   = 0
[pid  3147] munmap(0xb707a000, 79932)   = 0
[pid  3147] munmap(0xb708e000, 102048)  = 0
[pid  3147] munmap(0xb7281000, 48032)   = 0
[pid  3147] munmap(0xb70a7000, 1940224) = 0
[pid  3147] munmap(0xb72dd000, 104996)  = 0
[pid  3147] munmap(0xb7295000, 293584)  = 0
[pid  3147] munmap(0xb728d000, 30512)   = 0
[pid  3147] munmap(0xb7f23000, 10172)   = 0
[pid  3147] munmap(0xb72f7000, 292496)  = 0
[pid  3147] munmap(0xb7379000, 34492)   = 0
[pid  3147] munmap(0xb734b000, 184704)  = 0
[pid  3147] munmap(0xb7344000, 26584)   = 0
[pid  3147] munmap(0xb7448000, 93280)   = 0
[pid  3147] munmap(0xb738a000, 777552)  = 0
[pid  3147] munmap(0xb7382000, 32656)   = 0
[pid  3147] munmap(0xb7710000, 105012)  = 0
[pid  3147] munmap(0xb76c0000, 325144 <unfinished ...>
Process 11501 detached
Process 3147 detached

I use Debian Eth up-to-date and ISP RC5

I need to check work arounds from http://www.isp-control.net/forum/high-lo...-1103.html or in RC6 problem is Solved?
(This post was last modified: 08-08-2008 08:57 PM by gutek.)
08-08-2008 08:56 PM
Find all posts by this user Quote this message in a reply
ephigenie Offline
Project Leader
*******
Administrators

Posts: 1,578
Joined: Oct 2006
Reputation: 15
Post: #7
RE: Sometimes php5 process stress cpu
which php5 version are you using ?
Just because there were some issues with some php versions not killing their child processes when they ought to ...

Also : Do you use any kind of php accelerator like Ea , xcache, apc, ZendOptimizer ?
08-08-2008 09:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
gutek Offline
Junior Member
*

Posts: 11
Joined: May 2008
Reputation: 0
Post: #8
RE: Sometimes php5 process stress cpu
ephigenie Wrote:which php5 version are you using ?
Just because there were some issues with some php versions not killing their child processes when they ought to ...

Also : Do you use any kind of php accelerator like Ea , xcache, apc, ZendOptimizer ?

Code:
dpkg -l | grep php5-cgi
ii  php5-cgi                             5.2.0-8+etch11                       server-side, HTML-embedded scripting languag

I dont use php accelerators.
08-09-2008 12:59 AM
Find all posts by this user Quote this message in a reply
Lordek Offline
Junior Member
*

Posts: 22
Joined: May 2008
Reputation: 0
Post: #9
RE: Sometimes php5 process stress cpu
I dont use accelerators, only the etch version of php5
08-11-2008 12:58 AM
Find all posts by this user Quote this message in a reply
ramires Offline
Junior Member
*

Posts: 23
Joined: Aug 2008
Reputation: 0
Post: #10
RE: Sometimes php5 process stress cpu
i have same problem

top - 10:00:44 up 6 days, 1:07, 2 users, load average: 8.11, 8.20, 8.06
Tasks: 150 total, 8 running, 134 sleeping, 0 stopped, 8 zombie
Cpu(s): 32.7%us, 67.3%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1048724k total, 977724k used, 71000k free, 27996k buffers
Swap: 1048568k total, 20k used, 1048548k free, 538324k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
13331 vu2062 25 0 19440 5956 4132 R 2.3 0.6 50:31.00 php5-cgi
13326 vu2024 25 0 19444 5960 4132 R 0.7 0.6 46:32.22 php5-cgi
16655 vu2024 25 0 0 0 0 Z 0.3 0.0 0:00.01 php5-cgi <defunct>
16657 vu2024 25 0 0 0 0 Z 0.3 0.0 0:00.01 php5-cgi <defunct>
16682 vu2024 25 0 19336 2640 820 R 0.3 0.3 0:00.01 php5-cgi
16685 vu2024 24 0 0 0 0 Z 0.3 0.0 0:00.01 php5-cgi <defunct>
16687 vu2024 24 0 0 0 0 Z 0.3 0.0 0:00.01 php5-cgi <defunct>

same php5 version
version of omega RC6

i found a solution work like a charm...

http://www.isp-control.net/forum/high-lo...103-4.html
(This post was last modified: 09-03-2008 05:22 PM by ramires.)
09-03-2008 05:02 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)