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

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

 



Hi Eric, Richard,

Thank-you for your suggestions. I had already tried xdebug - the problem
that I had is that because of the CPU overload it was showing pretty much
everything as screwed! However by using absolute CPU time measures I managed
to work out what method was involved, and on removing it the situation is
completely resolved.

I still wonder if there is a neater way to do this!

Cheers,

Alex

On Sun, Jan 18, 2009 at 2:43 PM, Eric Butera <eric.butera@xxxxxxxxx> wrote:

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


-- 
Alex Davies

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender immediately by e-mail and delete this e-mail permanently.

[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