Re: athena eats my cpu

Werner Thie <[email protected]> Tue, 04 Sep 2007 12:32:53 +0200
Newsgroups gmane.comp.python.quotient.dev
Message-ID <[email protected]>
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

Werner Thie wrote:
> Hi all
> 
> I implemented a cardgame, which makes approximately one call up to the 
> client per second in autoplay mode. Everything is fine with one client, 
> the server runs for days, no apparent problem. Now, if I move my app 
> from Windows to a hefty OpenBSD V4.1) server class machine, multihomed 
> Internet connection, RAID, ... and connect 9 more clients I see an 
> initial CPU load of say 10%, everything is working seemingly fine, but 
> now things get out of hand: CPU usage is increasing steadily up until 
> where the server disconnects clients. Different type of reactors show 
> the same basic behavior, only the gradient of the increase varies. Linux 
> (Ubuntu server, latest version) shows the same symptoms. Windows comes 
> in first, with barely an increase in CPU usage detectable.
> 
> gc, cProfile to the rescue, I studied printouts for hours and tried to 
> detect a pattern, but so far no luck, I am out of my wits.
> 
> Has someone out there experienced such problems and is willing to give 
> me a hint, I am grateful for the smallest straw.
> 
> Thanks, Werner