Sunday, October 24, 2010

Re: CakePHP high CPU utilization

Can you paste your controller, view, layout and app/config/core.php code on
http://bin.cakephp.org/


2010/10/24 Ervin Hegedüs <airween@gmail.com>:
> Hello Matt,
>
>> No need to play with maxclients yet... You shouldn't have any, right?   :)
> yes, I just didn't know what about thinking are you.
>
>> By something interesting, I was referring to bullshit URLs being hit by
>> russian (or chinese or whatever) robots attempting to crack your apache
>> install or somesuch.
>
> probably no.
> As I described, the test environment of that app, where I measured
> these values, doesn't has too much load - in point of fact, that
> apache isn't used by anything...
>
>> IMHO, your problem isn't going to have anything to do with cake.   It's
>> going to be an illicit client
> what are you thinking about? Could you explain that?
>
>> or a buggy version of something *actually*
>> executable.
> eg apache, php?
>
> The productiv and test systems are differs, productiv is an older (apache, php).
>
>> The reason I say this is that PHP has a per script memory use
>> limit.  Either you have many illicit clients eating up no more than 32 (or
>> 64, whatever) MB per illicit URI (unlikely -- if this is the scenario,
>> they're most likely taking up only a few hundred K per thread because your
>> view is bare) or you have something executable installed that has a memory
>> leak or some such silliness.
>
> ok, but when I tested same ab with another test site of the test
> system, I _can't_ reproduce this effect - only just (this) Cake.
> (There is no another Cake app on that system.)
>
>> Read your logs (read more logs).  Take cake out of your web tree and see
>> what happens to utilization.  Take a look at the per-process memory usage
>> (i'm a little rusty on this stuff or I'd say what to use, but I'm currently
>> an *ex* developer/administrator).
>
> I don't knwo what have I look :)
>
> Scenario:
> - new controller with empty method
> - router contains this method
> - empty method renders default layout
> - testing empty method with ab
> - until 2-3 seconds when test runs, CPU usage is near 90% on all core.
>
> CPU usage also near 80-90% when I pointing ab to another
> controller/method, but only just this application.
>
>
> I would like to know, how can I find the part of code, which generates
> and sends to the client the default layout.
>
>
> Thanks:
>
>
> a.
>
>>
>> Matt Murphy
>>
>> On Sun, Oct 24, 2010 at 7:43 AM, Ervin Hegedüs <airween@gmail.com> wrote:
>>>
>>> Hello Matt,
>>>
>>> thanks for the reply,
>>>
>>> On Sun, Oct 24, 2010 at 1:26 PM, Matt Murphy <mattyhead@gmail.com> wrote:
>>> > I'd be curious to know what your apache logs are reporting during a high
>>> > utilization period...
>>>
>>> nothing... there are just client querys, nothing else.
>>> May be do you think about "increasing maxclients", but no - currently
>>> maxclients is 150, and I've tested with 100 client with ab.
>>>
>>> > Obviously, it isn't google indexing your empty view
>>> > over and over, but there might be something interesting.
>>>
>>> yes, but what is that?
>>>
>>> I'm suspecting to the rendering code of default layout - but I'm new
>>> in cake and don't have any free time to debug that code...
>>>
>>> How can I find that part of Cake (config, rendering...)?
>>>
>>>
>>> Thank you:
>>>
>>>
>>> a.
>>> > Matt Murphy
>>> >
>>> > On Sat, Oct 23, 2010 at 1:49 PM, airween <airween@gmail.com> wrote:
>>> >>
>>> >> Hello Cake Users,
>>> >>
>>> >> I'm new in Cake - exactly I'm not a Cake user/developer, I'm a system
>>> >> administrator.
>>> >>
>>> >> System is a LAMP enviroment, hardware is a HP DL380, with two CPU,
>>> >> every CPU has 2 cores.
>>> >>
>>> >> I've a site since few weeks ago - since then the CPU utilization isn't
>>> >> above 100%, but usually over 200%.
>>> >>
>>> >> I've created a controller, which does "nothing": it contains just a
>>> >> simple index() method, which's empty. Also I configured the routes,
>>> >> and when I get the URL:
>>> >>
>>> >> http://mysite/foo
>>> >>
>>> >> the default layout rendered, which has a header and a footer.
>>> >>
>>> >> I tested this controller on an another HW, which has 8 core; the
>>> >> client was ab (apache benchmark), and until the test I've monitored
>>> >> the system:
>>> >>
>>> >> sar -P ALL 1 1000
>>> >>
>>> >> (client: ab -n 100 -c 100  http://mysite/foo)
>>> >>
>>> >> Until the test sar reported this values:
>>> >>
>>> >> 19.27.17        CPU     %user     %nice   %system   %iowait
>>> >> %steal     %idle
>>> >> 19.27.18        all     88,38      0,00     10,88      0,00
>>> >> 0,00      0,75
>>> >> 19.27.18          0     89,00      0,00      9,00      0,00
>>> >> 0,00      2,00
>>> >> 19.27.18          1     83,00      0,00     17,00      0,00
>>> >> 0,00      0,00
>>> >> 19.27.18          2     91,00      0,00      9,00      0,00
>>> >> 0,00      0,00
>>> >> 19.27.18          3     90,00      0,00     10,00      0,00
>>> >> 0,00      0,00
>>> >> 19.27.18          4     90,10      0,00      9,90      0,00
>>> >> 0,00      0,00
>>> >> 19.27.18          5     86,87      0,00     13,13      0,00
>>> >> 0,00      0,00
>>> >> 19.27.18          6     91,00      0,00      9,00      0,00
>>> >> 0,00      0,00
>>> >> 19.27.18          7     87,00      0,00     10,00      0,00
>>> >> 0,00      3,00
>>> >>
>>> >> When test has finished, the %user has gone 0,00, and %idle about 99,9%
>>> >> again.
>>> >>
>>> >> On that machine another MVC frameworks and another sites (CMS's)
>>> >> (which uses Codeigniter, Drupal...) I _can't_ create this effect.
>>> >>
>>> >> I don't use .htaccess.
>>> >>
>>> >> Cake version is 1.2.8, I downloaded it today.
>>> >>
>>> >> What could be the problem?
>>> >>
>>> >>
>>> >> Thank you:
>>> >>
>>> >>
>>> >> a.
>>> >>
>>> >> Check out the new CakePHP Questions site http://cakeqs.org and help
>>> >> others
>>> >> with their CakePHP related questions.
>>> >>
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups
>>> >> "CakePHP" group.
>>> >> To post to this group, send email to cake-php@googlegroups.com
>>> >> To unsubscribe from this group, send email to
>>> >> cake-php+unsubscribe@googlegroups.com For more options, visit this
>>> >> group
>>> >> at http://groups.google.com/group/cake-php?hl=en
>>> >
>>> > Check out the new CakePHP Questions site http://cakeqs.org and help
>>> > others
>>> > with their CakePHP related questions.
>>> >
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "CakePHP" group.
>>> > To post to this group, send email to cake-php@googlegroups.com
>>> > To unsubscribe from this group, send email to
>>> > cake-php+unsubscribe@googlegroups.com For more options, visit this group
>>> > at
>>> > http://groups.google.com/group/cake-php?hl=en
>>> >
>>>
>>> Check out the new CakePHP Questions site http://cakeqs.org and help others
>>> with their CakePHP related questions.
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscribe@googlegroups.com For more options, visit this group
>>> at http://groups.google.com/group/cake-php?hl=en
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help others
>> with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscribe@googlegroups.com For more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: