[tor-relays] Sanity check on NumCPUs

Thoughts thoughts at kevinsthoughts.com
Fri May 27 18:11:06 UTC 2022


It was my impression from reading some older documents that tor didn't 
multithread well.  Its also been my observation, but wanted a sanity 
check to see if that was still the case.  For instance, on one quad core 
low-power system I had, tor would max out at 28% of CPU - using 100% of 
one core and about 12% of a second (for a total of 112/4 = 28% of the 
system).

On 5/27/2022 12:55 PM, Roman Mamedov wrote:
> On Wed, 25 May 2022 19:31:41 -0500
> Thoughts <thoughts at kevinsthoughts.com> wrote:
>
>> For a non-exit relay, is "NumCPUs 2" still the recommended maximum?
>> Running on a quad core and recently saw a message indicating I had
>> insufficient CPU power to support the desired number of connections...
> I'm not sure why would it be "the recommended maximum" to begin with.
>
> It would make sense in context of running 2 instances of Tor on a 4-core
> machine, to limit each to 2 CPUs, and then pin them to cores 0-1 and 2-3
> respectively with "taskset", for better cache locality and to ensure they
> never interfere with each other.
>
> Running only 1 instance with "NumCPUs 4" will not be as effective in total
> throughput as the setup described above. But if you aren't going to run a 2nd
> instance in any case, there's nothing to stop you from setting that to 4, or
> removing that line altogether and letting Tor autodetect the number of cores.
>


More information about the tor-relays mailing list