[tor-bugs] #25152 [Core Tor/Tor]: Try to call less circuitmux_find_map_entry()

Tor Bug Tracker & Wiki blackhole at torproject.org
Mon Feb 5 18:34:49 UTC 2018


#25152: Try to call less circuitmux_find_map_entry()
------------------------------+-------------------------------------
     Reporter:  dgoulet       |      Owner:  (none)
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.3.4.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  performance, tor-relay,
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+-------------------------------------
 The `circuitmux_find_map_entry()` function is currently taking more than
 3% of the CPU on a busy relay. It is literally the second highest after
 curv25519 crypto stuff (which is expected to be high).

 We can't really optimize that function so much but we can try to call it
 less! For instance, at every single cell we append to a circuit in
 `append_cell_to_circuit_queue()` we call `update_circuit_on_cmux()` which
 calls *4* functions in succession that calls
 `circuitmux_find_map_entry()`:

 * `circuitmux_is_circuit_attached()`
 * `circuitmux_attached_circuit_direction()`
 * `circuitmux_set_num_cells()` and this function can call it again with
 `circuitmux_make_circuit_inactive()` or
 `circuitmux_make_circuit_active()`.

 This is quite a lot of CPU at _each_ cell especially when we do have many
 many circuits.

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


More information about the tor-bugs mailing list