Jump to content

Relatively high cpu usage in idle (x86 build)


Recommended Posts


First of all, I want to state that utserver truly is an awesome piece of software engineering. Latest builds are very mature, I can hardly find any noticeble problems while running it 24/7.

Now, to the thing that is bothering me. Recently I've been running utserver on a very modest hardware which isn't capable of breaking any speed records.

Being an attentive person, I noticed that idling utserver (no downloads, no active webui) uses quite an amount of cpu time.

To investigate, I did a little experiment launching a separate clean copy of utserver isolated from WAN.

The easiest way to find a cpu eating culprit is to use powertop - it is quite useful little tool in similar situations. And this is what powertop told me:

Wakeups-from-idle per second : 33.2     interval: 5.0s
Top causes for wakeups:
38.9% ( 40.2) utserver
23.8% ( 24.6) swapper/0
20.3% ( 21.0) swapper/1
3.5% ( 3.6) swapper/2
2.9% ( 3.0) tmux
1.9% ( 2.0) [ath9k] <interrupt>
1.5% ( 1.6) [eth1] <interrupt>
...insignificant part redacted...

Amazing, idling utserver does a decent job on keeping cpu awake! It certainly isn't normal, as even known cpu hogs like ath9k can't keep up with idle utserver.

Now let's see what is going on in little more detail with strace help. Here's strace -t -T dump of main process activity: http://pastebin.com/raw.php?i=jmhNjGJd

It doesn't look too suspicious, the process is just infinitely looping with 1 second delay interval, checking system time on each iteration (I don't really understand why there are four stat64("/etc/localtime") calls for one gettimeofday(), but that isn't that bad, I guess.

OK, now to discover what utorrent threads are doing, with strace -t -T -f: http://pastebin.com/raw.php?i=iwByRRX5

I'm not an expert, but I was amazed by the number of syscalls per second utserver is generating... Is it really necessary?

What I'd really like to know is: should we expect any code optimisations/refactoring in the future, or the base will remain as it is?

Link to comment
Share on other sites

DHT is always running, so that's possibly generating high amounts of UDP traffic (long-lived nodes tend to have this problem...)

See if disabling it makes your problem go away, though that will hurt functionality significantly with public torrents.

Link to comment
Share on other sites

As I mentioned, for the sake of testing my vanilla utserver install is running without internet access, so disabling DHT is kind of futile. Anyways, I went ahead and disabled everything DHT related, restarted utserver - idle activity hasn't changed a bit. utserver still shows lots of syscall activity and leads powertop board.

Enabling internet access didn't change anything either.

To clarify one more time: I'm talking about splits of a second cpu time constantly consumed by utserver being in idle state (no active torrents, no webgui). This activity eats cpu time and kills power management. The reason of these wakes is shown in first posts strace threads log. The log is made with timestamps, so you can clearly see the syscalls happening ~20-25 times per second. I think this is some kind of oversight and surely can and should be improved...

Link to comment
Share on other sites

  • 1 month later...

I've been watching how much CPU it consumes.



It's 100% usage for a single core.

To solve this problem you need to launch utorrent as a daemon: ./utserver -daemon

It worked for me. I hope it helps to you too.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...