1

I have a 16 CPU core server that's experiencing consistent load averages of 40-70. After camping on a top command for a number of hours, I've isolated the CPU spikes to a single user.

After pressing c on the top command, the high-CPU command is /usr/bin/php /home/user/public_html/index.php, which is basically useless for isolating, as that's the main controller handler for our entire PHP MVC framework (CodeIgniter if you were curious).

The reason why I haven't toyed with a code profiler just yet is because it would appear that any PHP process under this user has consistently high CPU usage. I've double-checked our slow-query.log (MySQL) for good measure and this web app generates next to 0 slow queries.

Questions:

  • Is code profiling the main answer for this app?
  • Why would incoming PHP requests be consistently high for only one user?
  • Why would any and all incoming PHP requests for this web app be high CPU usage?
  • Could an overloaded or inefficient MySQL database cause these PHP processes to consume higher-than-normal CPU usage? Or are the two completely independent?
  • Time for a hardware upgrade? How do you know the difference?
0

Could an overloaded or inefficient MySQL database cause these PHP processes to consume higher-than-normal CPU usage? Or are the two completely independent?

PHP and MySQL are different processes, so when a slow MySQL query runs, and you are following with top, you definitely see MySQL start to load up the CPU.

Why would incoming PHP requests be consistently high for only one user?

To try and isolate the activity is this specific user, I would try to view the routes (and therefore controller actions being fired in codeigniter) that this user is accessing.

You didn't specify the OS, but assuming your app is running on apache+mod_php, so you should see the GET & POST request/routes being accessed in /var/log/apache2/access.log.* or /var/log/httpd/access*_log*. I'm assuming you have already checked /var/log/apache2/error.log.* or /var/log/httpd/error*_log* otherwise I'd check here too.

Hopefully this may provide some insight into the activity of this user

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.