Stem Docs

Bandwidth Heuristics

Bandwidth HeuristicsΒΆ

../../_images/back.png

To select the relays it will use Tor consults several factors. Exit policies, flags, as well as bandwidth heuristics so our circuits are zippy without overtaxing individual relays.

These statistics are collected by a special subset of our directory authorites called bandwidth authorities. See our bandwidth file specification for details. Statistics are publicly available and generated each hour...

import stem.descriptor.remote

bandwidth_file = stem.descriptor.remote.get_bandwidth_file().run()[0]

for fingerprint, measurement in bandwidth_file.measurements.items():
  print('Relay %s' % fingerprint)

  for attr, value in measurement.items():
    print('  %s = %s' % (attr, value))

  print('')
% python bandwidth_stats.py

Relay 6AD3EA55B87C80971F353EBA710F6550202A9355
  scanner = /scanner.5/scan-data/bws-59.4:60.1-done-2019-05-29-05:44:10
  measured_at = 1559123050
  pid_delta = -0.360692869958
  updated_at = 1559123050
  pid_error_sum = -0.178566523071
  nick = OrphanOrOften
  node_id = $6AD3EA55B87C80971F353EBA710F6550202A9355
  pid_bw = 538334
  bw = 538
  pid_error = -0.178566523071
  circ_fail = 0.0

Relay 11B6727E38D249C83E20EEB0647BAD4FACECBEB6
  scanner = /scanner.8/scan-data/bws-92.4:93.1-done-2019-05-23-16:06:26
  measured_at = 1558641986
  pid_delta = 0.0352270644197
  updated_at = 1558641986
  pid_error_sum = -0.822158700788
  nick = snap269
  node_id = $11B6727E38D249C83E20EEB0647BAD4FACECBEB6
  pid_bw = 21124
  bw = 21
  pid_error = -0.822158700788
  circ_fail = 0.0