How aggregation and scaling works

See also

How sbws works (scanner part).

Every hour, the generator:

  1. Aggregate all the measurements (not older than 6 six days) for every relay.
  2. Filter the measurements
  3. Scale the measurements
  4. Write the bandwidth file

Source code: sbws.lib.v3bwfile.V3BWFile.from_results()

Filtering the bandwidth measurements

Each relay bandwidth measurements are selected in the following way:

  1. At least two bandwidth measurements (Result s) MUST have been obtained within an arbitrary number of seconds (currently one day). If they are not, the relay MUST NOT be included in the Bandwidth File.
  2. The measurements than are are older than an arbitrary number of seconds in the past MUST be discarded. Currently this number is the same as data_period (5 days) when not scaling as Torflow and 28 days when scaling as Torflow.

If the number of relays to include in the Bandwidth File are less than a percententage (currently 60%) than the number of relays in the consensus, additional Header Lines MUST be added (see XXX) to the Bandwidth File and the relays SHOULD NOT be included.


Scaling the bandwidth measurements

Consensus bandwidth obtained by new implementations MUST be comparable to the consensus bandwidth, therefore they MUST implement torflow_scaling.

The bandwidth_file_spec appendix B describes torflow scaling and a linear scaling method.


Writing the bandwidth file

The bandwidth file format is defined in the bandwidth_file_spec.