[tor-bugs] #25373 [Core Tor/Tor]: Avoid needless wakeups for token bucket refills.

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Feb 27 20:51:05 UTC 2018


#25373: Avoid needless wakeups for token bucket refills.
------------------------------+--------------------------------
     Reporter:  nickm         |      Owner:  (none)
         Type:  enhancement   |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.3.4.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------------
 In 0.2.3.5-alpha, we increased our default token bucket refill interval
 from 1 time per second to 10 times per second.  (See #3630 and proposal
 183.)

 AFAICT, this is now the most frequently running timer causing wakeups on
 an idle Tor instance.  It even causes wakeups on Tor instances when
 DisableNetwork is set. We can do better!

 Two key insights:
   *  First, it is not necessary to actually refill these buckets
 periodically.  Instead, we can store the last time at which we refilled
 each one, and calculate its current size at immediately before we read or
 write.  The only thing we'll need to use a timer for is to wake up
 connections on which we've stopped reading or writing.

   * Second, we only need to have this timer active when at least one
 connection is blocked on bandwidth.

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


More information about the tor-bugs mailing list