<div dir="ltr"><div dir="ltr">There are early plans to distribute crypto operations across multiple cores [<a href="https://trac.torproject.org/projects/tor/ticket/1749">https://trac.torproject.org/projects/tor/ticket/1749</a>], but there might be a better way.</div><div dir="ltr"><br></div><div dir="ltr">(I registered, but I couldn't find a way to annotate the ticket, so I'm emailing for now)</div><div dir="ltr"><br></div><div dir="ltr">The ticket states the reason being to saturate the bandwidth available (by using all the cores as efficiently as possible).</div><div dir="ltr"><br></div><div dir="ltr">I don't understand why a relay needs to have a "main thread". Network traffic arrives as an async operation and can be sent back out asynchronously. So a final strategy shouldn't have a central thread. The main thread might still be needed for startup, runtime adjustment, and system upkeep, but not for the core network-crypto processing; that should never need to touch the main thread.</div><div dir="ltr"><br></div><div>The current proposal speaks about multi-threading crypto operations, let's call that "A) Speed - Speeding up processing of a single cell". Instead, I propose "B) Concurrency - Restructuring so multiple cells can be processed concurrently". </div><div dir="ltr"><br></div><div dir="ltr">A cell of data should arrive via IO-Completion thread on a random CPU core, have crypto transformation applied on the same one core, then be dispatched onward out via the network. This seems to be quite a simple approach where I would think crypto code can remain the same "single-threaded" implementation.</div><div dir="ltr"><br></div><div>Approach [A] will have diminishing returns as the number of cores increases. You can only break up a cell unit of work so much until you're encrypting one byte per cpu core. However, with approach [B], if you have millions of CPU cores (as an extreme) you can be processing millions of cells concurrently. Therefore, I believe approach [B] would be more scalable.</div><div dir="ltr"><br></div><div dir="ltr">What do you think? </div><div dir="ltr"><br></div><div>Regards,</div><div dir="ltr"><div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><span style="font-size:small">--</span></div><div><span style="font-size:small">Todd Hubers</span><br></div></div></div></div></div></div></div></div>