2

I am getting constantly high and wildly fluctuating CPU usage % for php-cgi commands as seen via "top" on my Centos server..

I have a server density account and it seems that this is a common trend:

User - PID - CPU % - MEM % - VSZ - RSS - TT - Stat - Started - Time - Command

500 - 6389 - 22.4 - 3 - 271136 - 32380 - ? - S - 20:26 - 0:40 - /usr/bin/php-cgi

Seems there are about 6 or so of those records in my processes list at any given check-in.

Any ideas what's causing this? I have fast_cgi installed and the module is loading.. Not sure why it isn't handling this though.

Any help would be greatly appreciated!

Ryan

quanta
  • 50,327
  • 19
  • 152
  • 213
Ryan Thompson
  • 123
  • 1
  • 1
  • 4

2 Answers2

5

php-cgi is responsible for actually running all your code. It's very normal to see these taking up resources all the time. If you're not seeing additional traffic to your website, this may be an indication that you have gotten hacked (people sending large amounts of spam or DDoS attacks via a compromised webserver will use lots of CPU).

I would suggest you stop using php-cgi and switch over to PHP-FPM. This would give you better visibility into what exactly is going on. It can also make things more efficient, as PHP-FPM workers can share one instance of an APC cache, while this may not be the case depending on how your php-cgi installation is configured. PHP-FPM also lets you enable the 'slow log', which captures a snapshot of what exactly is executing whenever a request takes longer then X seconds. This is very helpful for troubleshooting poor performance.

devicenull
  • 5,572
  • 1
  • 25
  • 31
0

php-cgi handles the fcgi requests. So it probably means that your PHP is doing some processing. One PHP process can easily go to 100% for some requests on some hardware (I know from my bad server). You should watch if this matches with your requests and and examine them.

Christopher Perrin
  • 4,741
  • 17
  • 32
  • It definitely doesn't. Traffic is actually quite a bit lower today. Any idea how I can track down exactly what script is causing this load? – Ryan Thompson Jun 21 '12 at 03:56
  • I just scaled up too. I didn't think I needed too but took my supports word on it. Nothin.. I doubled in size to a 2GB cloud.. Been doing just fine with less than 1GB. Not crazy traffic you know? – Ryan Thompson Jun 21 '12 at 04:05