I have read about Computing Bandwidth weights in Tor directory protocol, version 3. But I could not understand about how bandwidth weights are calculated. And since they appear only once in consensus, how they help in path selection by network balancing?

1 Answer 1


Maybe it's easiest to explain this by example. The following comes from the current consensus:

r TorNinurtaName AA8YrCza5McQugiY3J4h5y4BF9g TsD6f/8KF1h7Npm/w2vgkzDumjY 2014-05-08 23:15:06 9001 9030
s Fast Guard HSDir Named Running Stable V2Dir Valid
v Tor
w Bandwidth=238
p reject 1-65535
bandwidth-weights Wbd=849 Wbe=0 Wbg=4145 Wbm=10000 Wdb=10000 Web=10000 Wed=8301 Wee=10000 Weg=8301 Wem=10000 Wgb=10000 Wgd=849 Wgg=5855 Wgm=5855 Wmb=10000 Wmd=849 Wme=0 Wmg=4145 Wmm=10000

The W?? numbers are the bandwidth weights. For example, Wgg is the "Weight for Guard-flagged nodes in the guard position".

If your client were to consider that relay as a possible guard, it would multiply its consensus weight 238 with Wgg, so 238*5855=1393490. The reason is that this relay has the Guard flag, but not the Exit flag. Your client does that for all relays and then selects one of them.

  • How do these bandwidhth weights are calculated? What would be the effect on these weights on increasing and decreasing the bandwidth of a relay?
    – saurav
    May 28, 2014 at 6:22
  • Bandwidth weights are calculated by the directory authorities using a rather complex algorithm. It's described in the directory protocol specification in Section 3.8.3. "Computing Bandwidth Weights" (gitweb.torproject.org/torspec.git/blob/HEAD:/dir-spec.txt#l2157). If one of the bandwidth weights goes up (or down), all relays with the matching combination of relay flags will be more likely (or less likely) to be chosen by clients.
    – karsten
    May 31, 2014 at 8:21
  • What is the meaning of "w Bandwidth=238"? Is it the advertised bandwidth of a relay? If I increase the bandwidthup and bandwidthdown value of my relay, then will this "w Bandwith value" increase?
    – saurav
    Jun 9, 2014 at 2:03
  • 1
    "w Bandwidth=238" is the measured bandwidth of your relay: a subset of the directory authorities periodically run bandwidth measurements through your relay and then assign this value to it. If you raise your bandwidth rate and burst, and if you make sure that your provider does not throttle your connection, then the measured bandwidth value should go up. Give it a day or two for all directory authorities to measure your relay.
    – karsten
    Jun 10, 2014 at 8:25
  • 1
    That would be Wgd and Wed, respectively. See the definitions here: gitweb.torproject.org/torspec.git/blob/HEAD:/dir-spec.txt#l1709
    – karsten
    Aug 13, 2014 at 6:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .