[tor-bugs] #9682 [Tor]: Better work queue implementation for cpuworkers

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Sep 5 16:35:30 UTC 2013


#9682: Better work queue implementation for cpuworkers
---------------------------------------------+-----------------------------
 Reporter:  nickm                            |          Owner:
     Type:  enhancement                      |         Status:  new
 Priority:  normal                           |      Milestone:  Tor:
Component:  Tor                              |  0.2.5.x-final
 Keywords:  tor-relay performance cpuworker  |        Version:
Parent ID:                                   |  Actual Points:
                                             |         Points:
---------------------------------------------+-----------------------------
 Our current implementation for passing work to cpuworkers and getting
 answers from them is pretty bulletproof: we share an fd with each one,
 write our requests there as a serialized struct, and get our answers back
 as serialized struct.  The cpuworker learns about new requests by calling
 read(); we learn about new answers from libevent().

 But probably this isn't as efficient as it could be:
    * We should have a work queue implementation that doesn't require a
 cpuworker to wait for the main process to give it more data after each
 request it answers.
    * We should have a work queue implementation that uses condition
 variables as appropriate to notify cpuworkers of new data.
    * We should use appropriate libevent mechanisms notify the main thread
 of new answers.  (There are a bunch of ways to implement a condition
 variable that wakes libevent; we should pick one.)
    * We should manage the communication in-memory rather than over
 sockets.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9682>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list