I am worrying about high CPU load averages varying from 4 to 10 (dual core)
Not sure if related: with dmesg I am getting around 3 or 4 messages like this one (error 4 and error 6)
php-cgi[27971]: segfault at 00000000010006f9 rip 000000386b87288e rsp 00007fff26e70e50 error 4
This is a clean Virtualmin installation on Centos 5.6 Linux 2.6.18-238.12.1.el5xen on x86_64
Number of visitors: 10000/day aprox Stable since fresh installation
I appreciate for any clue.
Thanks.
PS: coincident bots spidering my site (lot of pages) may be involved?
Well, I’ve occasionally seen those PHP segfaults. How big a problem they are depends on how frequent they occur. If you’re seeing 3-4 of those an hour, I’d say that’s a problem. If you’re seeing 3-4 a month, I’m not sure that I’d be too concerned about that.
Which PHP version are you using? If you’re using the CentOS default of 5.1.6, you could try upgrading to 5.2.17 from the Virtualmin bleed repo.
However, I don’t think that’s related to your CPU load issue.
The key is to figure out what’s generating the load, as well as verify that you have adequate resources.
One thing you may want to do is check your available RAM, by running:
free -m
That’ll show how much RAM is available, as well as how much swap is being used.
Another thing would be to verify that you don’t have a ton of messages in your mail queue. You can do that by running:
mailq | tail -1
I wouldn’t be too concerned if it’s lower than 50, maybe even 100. Much higher than that, and that’s a bit on the unusual side.
Lastly, you can use the “top” command to get an idea of what programs are using a lot of the CPU.
It looks like you have enough RAM, and you aren’t using that much swap.
What I would be doing is concentrating on what processes are running, and trying to determine from that where the trouble is.
When running “top”, which processes repeatedly show up near the top of the output?
If you see a lot of “php” related processes, take note of what user owns the process. If you keep seeing one particular user’s name over and over, you may need to review the apps running on that user’s account. You may want to look at the log files for that domain, and see if anything appears out of the ordinary.
Similarly, you may want to look at Virtualmin’s bandwidth information, in System Settings -> Bandwidth Monitoring. Take note of which domains are using a lot of bandwidth, then review those sites as well to see if one of them is part of the higher load you’re seeing.
As for your processes – it looks like MySQL is getting hit pretty hard… which may mean you’re just getting a lot of traffic, or it could mean that an app you’re using is hard on the database.
I also see that there’s a process called “searchd” which is using quite a bit of CPU time. That could be related so the problems you’re seeing.
Hello Eric,
I am looking into mysql queries.
mysql_tuner does not show big problems.
I’ve enabled log long queries with log-slow-queries=/var/log/slow_query_log but few data was recorded (2secs)
Show processlist only displays a few of queries each refresh, time=0 or so.
Phpmyadmin shows more info. An average of 4000 queries/sec seems a little high.
I am looking into it, I don’t see anything wrong, lot of cached queries
Max concurrent connections: 13
Just now I had to restart Apache because of
[warn] mod_fcgid: can’t apply process slot for …(any http request)
I never got this issue.
Traffic and other related stuff are similar to months ago, less than in May, for example.
searchd is a daemon from a search engine. It does not use mysql resources.
Thanks
I’ve changed some code and got drastically reduce cpu use by mysqld. My next question is if is it normal to have high php-cgi cpu values Thank you
Well, whether that’s normal depends on the application… some applications require more CPU than others
Also, if you’re using FCGID, that means the php-cgi processes may stick around for more than just one session, as they cache code in memory in order to speed up site access. In that case, the CPU time you see is over the course of that process serving multiple users.