Windows relay: 85% of CPU power is wasted inside select() call
Since I have eliminated the network slowdown with patch from #22798 (moved), 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 tor_cpu.png|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