Opened 21 months ago

Last modified 21 months ago

#23433 new defect

Windows relay: 85% of CPU power is wasted inside select() call

Reported by: Vort Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version: Tor: 0.3.1.5-alpha
Severity: Normal Keywords: tor-relay windows
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Since I have eliminated the network slowdown with patch from #22798, I have started to face another problem:
As connection count began to grow, CPU resources consumption start growing too.
Now, with 3700 connections and 1 MiB/s of Tor traffic, CPU is loaded at 15%.
With 3 MiB/s of traffic, CPU load goes up to maximum 25% (full load of 1 CPU core).
It is possible to think that Tor uses much cryptography and that thing is overloading my PC. But no.
Much of the time (88 hours of total 102 hours) tor.exe process spends in kernel mode. Most probably, inside WS2_32.dll!select function (called from libevent library).
This specificity limits maximum speeds, which can be achieved using Tor relay with Windows.
And, most likely, it can be fixed by using the different approaches for network API interaction.

CPU: Intel Core i5-4690
OS: Windows 7 SP1 x64

Child Tickets

Attachments (1)

tor_cpu.png (10.7 KB) - added by Vort 21 months ago.

Download all attachments as: .zip

Change History (3)

Changed 21 months ago by Vort

Attachment: tor_cpu.png added

comment:1 Changed 21 months ago by cypherpunks

WS2_32.dll!select is a final destination of code, in top, always.

And, most likely, it can be fixed by using the different approaches for network API interaction.

Good luck with implementing it.

Try to increment TokenBucketRefillInterval option, any difference?

comment:2 Changed 21 months ago by Vort

Try to increment TokenBucketRefillInterval option, any difference?

Most likely, no.
With TokenBucketRefillInterval 300 I see same kernel/total proportions (~85%) and same CPU load (~15%, ~1MiB/s, ~3500 connections).

Note: See TracTickets for help on using tickets.