• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

High system load (Apache) and MySQL problem

K

kerm1t

Guest
Hello,

My box hosts around 25 websites, most of which are Php/MySQL driven. The traffic they recieve is fairly modest, and the system itself is fairly powerful (3 GHz, 512 MB). Unfortunately, the load is rather high:

# uptime
15:23:36 up 18 days, 18:50, 3 users, load average: 7.70, 8.15, 8.21

It's at this level constantly, so it can't be a blip caused by a particularly resource intensive script.

Apache seems to be the main culprit:

# ps aux|grep httpd
root 25963 0.0 2.0 21608 10596 ? S 00:29 0:00 /usr/sbin/httpd
root 25971 0.0 2.0 21552 10536 ? S 00:29 0:00 /usr/sbin/httpd
apache 4155 11.1 2.5 23424 12988 ? R 10:54 30:17 /usr/sbin/httpd
apache 4156 10.1 2.9 25380 15068 ? R 10:54 27:36 /usr/sbin/httpd
apache 4212 10.1 2.9 25712 15284 ? R 10:55 27:36 /usr/sbin/httpd
apache 4766 11.4 2.4 23048 12784 ? R 11:00 30:24 /usr/sbin/httpd
apache 4767 11.2 2.8 24768 14368 ? R 11:00 30:02 /usr/sbin/httpd
apache 4872 11.5 3.0 25692 15364 ? R 11:00 30:34 /usr/sbin/httpd
apache 4873 12.8 2.9 25476 15116 ? R 11:00 33:58 /usr/sbin/httpd
apache 20915 0.6 2.7 24172 14044 ? S 13:43 0:40 /usr/sbin/httpd
apache 20927 0.6 2.8 24432 14344 ? S 13:43 0:41 /usr/sbin/httpd
apache 21090 0.6 2.7 24168 14092 ? S 13:45 0:39 /usr/sbin/httpd
apache 22027 0.6 2.7 24316 14152 ? S 13:53 0:36 /usr/sbin/httpd
apache 23973 0.5 2.7 24380 14300 ? S 14:12 0:25 /usr/sbin/httpd
apache 24564 0.5 2.7 24176 14120 ? S 14:18 0:23 /usr/sbin/httpd
apache 24790 0.5 2.6 23828 13752 ? S 14:22 0:22 /usr/sbin/httpd
apache 24791 0.5 2.7 24068 14020 ? S 14:22 0:21 /usr/sbin/httpd
apache 24792 0.5 2.7 24292 14252 ? S 14:22 0:20 /usr/sbin/httpd
apache 27643 0.5 2.7 24052 13936 ? S 14:58 0:09 /usr/sbin/httpd
apache 28475 0.5 2.7 23972 13868 ? S 15:08 0:05 /usr/sbin/httpd
root 29758 0.0 0.1 3688 668 pts/2 S 15:25 0:00 grep httpd

StartServers is defined in httpd.conf as 8. Presumably the PIDs 4xxx are these initial servers, and the higher PIDs have been spawned to deal with client requests.

Any thoughts why these initial servers are using so much CPU time? How would I go about determining where the bottleneck is (ie is it a Php script, or perhaps a modrewrite)



On a possibly related noted, I upgraded MySQL a couple of days ago (from 3.23 to 4.1). I've been starting it from it's init script in /etc/rc.d/init.d/ (the Plesk CP doesn't appear to offer a way to start/stop MySQL), but it's ignoring the pid-file setting in /etc/my.cnf, and writing it's PID to a different filename (was mysql.pid, now it's $hostname.pid).

There are currently 45 instances of mysql running, and the number seems to go up by a few everyday (it doesn't seem to be related to the number of http processes, ie I don't believe all these mysql processes are being spawned by Apache serving up dynamic pages to visitors). Could the misnamed pid file be causing fresh MySQL processes to launch?

Thanks
 
Back
Top