lsphp5 is using too much CPU

hpham

Active Member
#1
When using top, here is the result

top - 23:09:01 up 15 days, 13:04, 1 user, load average: 10.80, 10.31, 8.08
Tasks: 127 total, 16 running, 111 sleeping, 0 stopped, 0 zombie
Cpu(s): 45.6%us, 3.7%sy, 0.0%ni, 0.5%id, 0.0%wa, 0.1%hi, 0.0%si, 50.2%st
Mem: 4194304k total, 2590184k used, 1604120k free, 223184k buffers
Swap: 2097144k total, 0k used, 2097144k free, 1790964k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23648 mysql 15 0 360m 79m 4864 S 52 2.0 10:44.56 mysqld
8301 user-name 16 0 153m 46m 25m R 25 1.1 0:07.09 lsphp5
7919 user-name 19 0 155m 50m 29m S 24 1.2 0:13.80 lsphp5
8091 user-name 22 0 153m 46m 25m R 18 1.1 0:14.10 lsphp5
8352 user-name 19 0 154m 46m 25m R 16 1.1 0:05.84 lsphp5
7897 user-name 17 0 156m 47m 26m R 15 1.2 0:16.48 lsphp5
8256 user-name 16 0 153m 46m 25m R 12 1.1 0:08.14 lsphp5
Usually, I don't see that much. Is there any way to find out it's because of bad script, or bad configuration of my lsws?

Thanks.
 

mistwang

LiteSpeed Staff
#2
In suexec mode is each PHP instance uses its own independent in memory cache, not shared among PHP processes.

I currently recommend eAccelerator with disk cache in /dev/shm .
 

hpham

Active Member
#4
well... from the top command, when there are 13+ tasks running, the load still going up to 12+. There is still nearly 2GB free RAM.

top - 00:31:35 up 15 days, 14:26, 1 user, load average: 13.24, 8.43, 9.18
Tasks: 127 total, 13 running, 114 sleeping, 0 stopped, 0 zombie
Cpu(s): 43.6%us, 4.0%sy, 0.0%ni, 0.7%id, 0.0%wa, 0.1%hi, 0.2%si, 51.5%st
Mem: 4194304k total, 2531036k used, 1663268k free, 225356k buffers
Swap: 2097144k total, 0k used, 2097144k free, 1825460k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23648 mysql 15 0 358m 82m 4876 S 42 2.0 49:46.34 mysqld
6510 user-name 17 0 99280 31m 21m S 28 0.8 0:21.27 lsphp5
6608 user-name 16 0 98.0m 32m 21m R 24 0.8 0:23.17 lsphp5
4877 user-name 16 0 98.2m 32m 21m R 20 0.8 0:24.97 lsphp5
7570 user-name 16 0 98.0m 32m 21m S 20 0.8 0:03.42 lsphp5
7522 user-name 19 0 99488 31m 21m R 19 0.8 0:02.24 lsphp5
3560 user-name 15 0 100m 32m 22m R 15 0.8 0:32.80 lsphp5
7314 user-name 17 0 98.2m 32m 21m S 9 0.8 0:05.31 lsphp5
4981 user-name 18 0 99492 31m 21m R 5 0.8 0:29.18 lsphp5
5529 user-name 18 0 98.2m 32m 21m R 5 0.8 0:27.71 lsphp5
Any other tip please? I am using lsws 2-CPU license on quad-core CPU server
Thanks.
 

hpham

Active Member
#9
I run strace today, here is the result
-bash-3.2# strace -c /usr/local/lsws/fcgi-bin/lsphp5
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
56.67 0.000034 1 41 mprotect
43.33 0.000026 0 290 umask
0.00 0.000000 0 46 read
0.00 0.000000 0 91 54 open
0.00 0.000000 0 36 close
0.00 0.000000 0 9 6 stat
0.00 0.000000 0 38 fstat
0.00 0.000000 0 16 lstat
0.00 0.000000 0 2 lseek
0.00 0.000000 0 90 mmap
0.00 0.000000 0 10 munmap
0.00 0.000000 0 25 brk
0.00 0.000000 0 8 rt_sigaction
0.00 0.000000 0 1 rt_sigprocmask
0.00 0.000000 0 1 1 ioctl
0.00 0.000000 0 2 1 access
0.00 0.000000 0 5 select
0.00 0.000000 0 1 shmget
0.00 0.000000 0 1 shmat
0.00 0.000000 0 1 shmctl
0.00 0.000000 0 1 dup2
0.00 0.000000 0 1 1 getpeername
0.00 0.000000 0 1 execve
0.00 0.000000 0 1 uname
0.00 0.000000 0 7 fcntl
0.00 0.000000 0 2 getcwd
0.00 0.000000 0 272 272 mkdir
0.00 0.000000 0 1 unlink
0.00 0.000000 0 2 readlink
0.00 0.000000 0 1 gettimeofday
0.00 0.000000 0 1 getrlimit
0.00 0.000000 0 6 getppid
0.00 0.000000 0 1 arch_prctl
0.00 0.000000 0 1 setrlimit
0.00 0.000000 0 2 time
0.00 0.000000 0 2 futex
0.00 0.000000 0 1 set_tid_address
0.00 0.000000 0 1 set_robust_list
------ ----------- ----------- --------- --------- ----------------
100.00 0.000060 1018 335 total
mprotect? umask? all calls to mkdir error?
 
Last edited:

mistwang

LiteSpeed Staff
#10
It does not looks right.

Better trace individual calls with

strace -tt -T -p <pid>

You can get a clue about what is going on as well.
 
Top