File: generator.rst

package info (click to toggle)
sbws 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,084 kB
  • sloc: python: 10,432; sh: 146; makefile: 38
file content (64 lines) | stat: -rw-r--r-- 2,177 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.. _generator:

How aggregation and scaling works
=================================

.. seealso:: :ref:`scanner` (scanner part).

Every hour, the generator:

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

Source code: :func:`sbws.lib.v3bwfile.V3BWFile.from_results`

.. _filtering-measurements:

Filtering the bandwidth measurements
-------------------------------------

Each relay bandwidth measurements are selected in the following way:

#. 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.
#. 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.

.. image:: ./images/activity_aggr_file.svg

.. image:: ./images/activity_aggr_lines.svg

.. _scaling-the-bandwidth-measurements:

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.

.. image:: ./images/activity_scaling_as_torflow.svg

.. seealso:: :ref:`torflow_aggr` and :ref:`differences`.


Writing the bandwidth file
---------------------------

The bandwidth file format is defined in the bandwidth_file_spec_.


.. _torflow_scaling: https://gitlab.torproject.org/tpo/network-health/torflow/-/blob/main/NetworkScanners/BwAuthority/README.spec.txt?ref_type=heads#L298
.. _bandwidth_file_spec: https://spec.torproject.org/bandwidth-file-spec/