2

I keep getting RAM and CPU spikes but I can't figure out where it is coming from.

If I look at the Process manager, I see,

/usr/bin/php /home/hellohel/public_html/index.php

Repeated several times. I also occasionally see:

[php] <defunct>

Taking up about 30% of my CPU! I have a very powerful server (Cloud VPS) with a lot of CPU and a lot of RAM. Usually I sit at a healthy 7-9% memory and CPU usage, but every once in a while there is a spike that slows my site way down. My site gets a LOT of traffic through out the day and I don't think the spikes are from high traffic spikes, but rather some sort of memory leak.

My biggest question is this:

When I look at my Daily Process log, I see:

49.0%   /usr/bin/php /home/hellohel/public_html/index.php

When in fact, this directory does not even exist. There is no /usr/bin/php / directory. The real script is located at:

/home/hellohel/public_html/index.php

What is going on here? Or is this all normal...

Chad Harrison
  • 6,990
  • 10
  • 29
  • 41
kmoney12
  • 205
  • 1
  • 3
  • 6
  • some kind of maintenance cron job? – andol Jan 14 '13 at 16:59
  • If 7-9% is your normal usage in a cloud environment, you're overpaying. When spend money on equipment to leave it idle? An important feature of the big cloud players is the ability to scale up when you need it, so that you only pay for what you use... and you _want_ your utilization to always be high. – Joel Coel Jan 14 '13 at 23:03

3 Answers3

8

/usr/bin/php is the PHP binary (php "parser", the "thing" that runs your php code), which is running a script: /home/hellohel/public_html/index.php.

I would check that script, to see what's causing it to use up that much resources.

mulaz
  • 10,682
  • 1
  • 31
  • 37
  • Is there a reason I see '/usr/bin/php /home/hellohel/public_html/index.php' so many times in the process list? It is there hundreds of times...shouldnt it disappear after processing? – kmoney12 Jan 14 '13 at 17:48
  • It disappears when the script finishes. If there is something in the script that takes alot of time, and many users open that page at the same time, it will be in the process list many times. – mulaz Jan 14 '13 at 18:28
  • Or if there is an infinite loop, or some weird IOwait, it will run until a timeout set in php.ini – mulaz Jan 14 '13 at 18:35
3

/usr/bin/php is the path to the PHP CLI binary on your VPS, it's normal to see this appearing in logs.

So, when you see this:

49.0%   /usr/bin/php /home/hellohel/public_html/index.php

It's showing that your script 'index.php' is being executed by PHP and is using 49.0% CPU. The slowness that you're experiencing could be related to a surge in traffic or some poorly optimized code.

Jake Stubbs
  • 176
  • 3
2

/usr/bin/php is the executable name for the php interpreter. /home/hellohel/public_html/index.php is the path to the script which the interpreter is running. You may want to check that script code and your VPS provider on optmizing php script execution.

Thomas G
  • 631
  • 4
  • 6