aMule Forum
English => en_Bugs => Topic started by: tonio on June 25, 2009, 01:27:32 PM
-
Hi there,
Running powertop on my server reveals amule daemons (amuled, amuleweb) cause a lot of wake up (80 times per second), which is not good for the earth ....
Digging into the code, this is due to main loop composed like this :
loop {
ProcessPendingEvents()
select(some fds, 10ms)
}
The events we are talking about are wx events, but precisely i don't know what kind as i thought wx is a widget toolkit and we are talking about a command line daemon ... However, instrumenting the pending events lists shows that really, there are events to process.
Anyway, thinking i've no use for 'realtime' events handling on my non interactive daemon, i increased the timeout to 1s which results in a much lower power usage (around 10 wkaeup per seconds) and a happy feeling for my planet.
What do you think about this ?
+++
tonio
-
aMule is already doing well regarding wake-ups: (See http://bugs.amule.org/view.php?id=1122) and 80 wake-ups allow for ~12ms of sleep - that's a very good value.
Compare with a snapshot of my system: (not running amuled)
Cn Avg residency P-states (frequencies)
C0 (cpu running) ( 1.7%) 1.60 Ghz 0.7%
C0 0.0ms ( 0.0%) 1333 Mhz 0.0%
C1 halt 0.0ms ( 0.0%) 1067 Mhz 0.0%
C2 0.1ms ( 0.0%) 800 Mhz 99.3%
C3 13.3ms (98.3%)
Wakeups-from-idle per second : 74.1 interval: 15.0s
Anyway, there's unfortunately a problem with your proposed improvement. select() is used to accept a new network connection. When you limited the possibilities to accept new connections by increasing the time between each select(), you reduce the number of connections drastically.
In other words: You reduce performance. A lot.
If you actually want to save power, use a system with a very low power consumption. My BeagleBoard (http://beagleboard.org/) for instance uses less than 3 Watts under load and I can power the whole system + external HDD, Wifi, Keyboard/Mouse with a USB-hub whose power adaptor allows 10 Watt maximum. I haven't used ot for aMule, but it should be easily potent enough.
To compare: In my experience you can count yourself happy if you achieve 8-10 Watts minimum with an idling notebook.
-
Hi,
(Unfortunatly, the bug tracker is currently out of order for registering ... APPLICATION ERROR #800)
The time given in the select call is not a sleep time but a timeout. This means the select call is "sleeping" AT MOST this time but wakes up as soon as there is some activty on the socket (new connection, packet to handle, etc).
As such, increase in the timout will not degrade network performance, it just reduces the frequency the rest of the loop is called (ProcessPendingEvent()) in case the select call reaches the timeout (ie ; when there is no network activity).
The question is what ProcessPendingEvent() really handles and what is the impact of its throttling ...
+++
tonio
-
Please excuse my ignorance regarding select.
Anyway, the bug report complains about 1000 wake-ups per second - we're already down quite a bit, I hope.
I can't help you with the exact nature of ProcessPendingEvent (it's unique to wx console applications), maybe someone else can.
-
Thank you !
I'll try to investigate this a little bit more afterwards..
CU
+++
tonio
-
Most likely you actually registered. The Mantis bug tracker always displays an error if you add content.
It does so for me when I post a new message. So try to log in even though you received the error above. ;)