Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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...

share|improve this question
    
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 Answers 3

up vote 8 down vote accepted

/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.

share|improve this answer
    
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? –  hellohellosharp 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

/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.

share|improve this answer

/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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.