Re: athena eats my cpu

Jean-Paul Calderone <[email protected]> Tue, 4 Sep 2007 07:33:14 -0400
Newsgroups gmane.comp.python.quotient.dev
Message-ID <20070904113314.8162.271011593.divmod.quotient.3565@ohm>
On Tue, 04 Sep 2007 12:32:53 +0200, Werner Thie <[email protected]> wrote:
>Hi all
>
>cProfile revealed quite some information after all:
>
>Load: 1 client / one round
>1339223 function calls (1288601 primitive calls) in 178.951 CPU secs
>
>    Ordered by: call count, cumulative time, function name
>
>    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>    207112    0.680    0.000    0.680    0.000 reflect.py:294(qual)
>    203237    1.323    0.000    1.985    0.000 context.py:57(remember)
>      6297    0.078    0.000    1.902    0.000 http.py:995(lineReceived)
>
>These two calls expose the runaway behavior, when compared to a longer 
>session with more calls:
>
>Load: 3 clients / ten rounds each
>33541459 function calls (33103528 primitive calls) in 859.489 CPU secs
>
>    Ordered by: call count, cumulative time, function name
>
>    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>  12365203   47.731    0.000   47.731    0.000 reflect.py:294(qual)
>  12328491   96.050    0.000  143.579    0.000 context.py:57(remember)
>     70214    0.955    0.000    8.527    0.000 http.py:995(lineReceived)
>
>Discussion: According to lineReceived we would expect a buildup of the 
>figures by a factor of around ten, the two top lines show a factor of app 
>60.
>
>Question: How wrong is it, to have a LivePage behind a guard?
>
>According to my suffering, it must be wrong as hell!
>
>Thxs, Werner

There shouldn't be a performance problem with only 9 or 10 clients, and using
Athena for a page behind guard should also work without difficulties.

With 200k calls for 1 client doing 1 round, I would expect only 3M calls for
3 clients doing 10 rounds each, but your profile shows 4 times this many
calls.  This seems to suggest some non-linear behavior which could certainly
blow up to (even more) unreasonable levels by the time you get to 9 clients.

Do your clients interact with each other, or are they each independent?  You
might also want to look at the actual payloads of the HTTP requests Athena
is making.  There may be a bug where it sends more an more irrelevant or
duplicate data as time goes on.  Firebug is somewhat handy for this kind of
inspection.

Jean-Paul