Re: How to get cpu consumption of a php script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please take into account that lighttpd does have some random high cpu-consumption problems, it could be that also. Give nginx a try instead. 

Also: microtime by itself isn't enough, sum time() to it because if a script lasts more than 1 second you can end up with negative total time, microtime doesn't have a seconds counter, only microseconds.

Are you using a cms? Have you tried deactivating some plugins?

Sent from my iPhone

On 17-01-2011, at 7:23, Tanoor Dieng <newstanoor@xxxxxxxxx> wrote:

> Hi everybody,
> I'm a php developper for a high traffic website. Our web servers run with
> lightty?
> 
> We have some issues with the cpu consumption of our servers.
> 
> The problem is that, we don't know exactly which script consumes so much
> cpu.
> So, we cant to figure out how much cpu does a php script take.
> 
> We have tried 3 methods:
> 
> 1) Microtime: microtime at the beginning and at the end and make the diff.
> The problem with that is that it takes the execution time of the script, but
> in our script we make:
> - connection to database
> - connection to memcache
> - connection to session server
> 
> All of this is not taken into account, so microtime is not that accurate
> 
> 2) Shell command: we get the pid of the process executing the script and
> make a 'top' on this pid . The problem  is that the php-cgi manages many
> threads so it's not accurate too.
> 
> Is there other methods for dealing with this problem.
> 
> Thanks,
> best regards,
> 
> Tanoor.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux