Re: 100% CPU Usage somewhere in script - how to find it?

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

 



On Sun, Jan 18, 2009 at 3:16 AM, Alex Davies <alex@xxxxxxxx> wrote:
> Hi,
>
> I use a (externally developed) library within my application which
> used to work fine. However, after a recent update (which unfortunately
> we can't roll back due to dependencies) I have crazy CPU loads - there
> are ~20 cores in total on the webservers and they have gone from an
> average utilization of ~5% to >99%. I am using lighttpd, and so I can
> see the php-cgi processes using 99% all my CPU!
>
> I have an extremely basic understanding of how to track this down, and
> using XDebug and KCacheGrind I think that I have a pretty good idea
> which area the problem lies in, but the "problem" is that because
> whatever it is that has broken is using up the whole CPU everything
> else slows down. Furthermore, it would appear that a large part of
> what gets scheduled is luck because sometimes things are instant and
> the same activity a short while later can take forever. However, based
> on absolute CPU time's from this XDebug/KCacheGrind analysis and a gut
> hunch based upon what has changed recently I think I know roughly what
> it is. I do have a diff of the recent code change, and I have looked
> at it to no avail.
>
> My questions are:
> - Is there a better way to see what is using up the CPU? There must be
> a single loop or something talking to an external service, that is
> using so much CPU user time. Is there a super-quick way to do to this?
> I really need to know what function (or even line) is using all that
> CPU time, because I can't spot it in the code. Perhaps this
> information can be obtained from XDebug but I can't find it!
> - If there is no such magic answer to this question, what is the
> correct way to find such a phantom problem? Are there any other
> applications that might be better?
>
> If anyone has any personal recommendations for Consultants able to
> look at and fix this sort of problem that would be much appreciated
> too; I am now well out of my depth and sinking fast!
>
> Many thanks for any help,
>
> Alex
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

XDebug can produce a result showing time spent in each function across
an entire run.  So if you were somehow able to turn on xdebug and
reproduce this issue, it would indeed say what function/method this
was happening in.

http://xdebug.org/docs/profiler

Sounds like that'd be pretty tricky, so good luck.

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