High php load for no reason! Please help!

Kh@lid

Member
Apr 29, 2003
20
0
151
Hi,

I have a server with one single website, yes it has many visitors but it is hard to browse the pages (nuke and vb) becase it is so slow. The load of the server is very high. And even when I stop mysql, the load is still high, it doesn't go down unless I stop httpd!

Once I start httpd, the load jumps up instantly. I've tried every single thing to know the source of the problem but I couldn't. I installed a php Eaccelerator and rebuilt apache, but everything remined the same.

I've used the Show Current CPU Usage function on WHM, and I found "php" and "mysql" are on the top, and when I click on the pids, and then trace, lines written on the screen and it doesn't end!

Please look at the attachment picture of the "top" and tell me if you can find something wrong!


Thanks in advance!



Khalid
 

Attachments

AndyReed

Well-Known Member
PartnerNOC
May 29, 2004
2,217
4
193
Minneapolis, MN
Kh@lid said:
I have a server with one single website, yes it has many visitors but it is hard to browse the pages (nuke and vb) becase it is so slow. The load of the server is very high. And even when I stop mysql, the load is still high, it doesn't go down unless I stop httpd!
The CPU load is 6.5. That's not very high since you have a high traffic Web site. Are you sure you are not under DoS or DDoS attacks? If not, then you might be under Intrusion Attacks. To learn the difference between these attacks, go to: http://servertune.com/kbase/security/attacks.html
 

flashweb

Well-Known Member
Mar 13, 2003
256
2
168
cPanel Access Level
Root Administrator
It can caused by some attacks or poor PHP scripts.

To see if there is an attack, try running netstat

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort

See if any IP have lot of requests, if yes, ban them with firewall.
 

koolcards

Well-Known Member
Oct 8, 2003
146
0
166
Tampa, Fl
not many processes and your memory swap looks good so it's probably php being kept open waiting for mysql queries to close.
increase the amount of sort memory available to mysql in /etc/my.cnf, depending on the amount you have installed. Play with these until it smooths out.

[mysqld]
set-variable = key_buffer=128M
set-variable = max_allowed_packet=1M
set-variable = table_cache=128
set-variable = sort_buffer=2m
set-variable = net_buffer_length=128K
set-variable = myisam_sort_buffer_size=128M

[isamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[myisamchk]
set-variable = key_buffer=128M
set-variable = sort_buffer=128M
set-variable = read_buffer=2M
set-variable = write_buffer=2M