bbperf 0.0.4__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bbperf-0.0.4 → bbperf-0.0.6}/PKG-INFO +36 -18
- bbperf-0.0.6/README.md +135 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/pyproject.toml +1 -1
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/bbperf.py +21 -21
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/client.py +3 -5
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/const.py +16 -4
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/control_receiver_thread.py +54 -13
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/data_receiver_thread.py +6 -11
- bbperf-0.0.6/src/bbperf/data_sample_evaluator_class.py +37 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/data_sender_thread.py +21 -8
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/json_output_class.py +6 -11
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/output.py +24 -35
- bbperf-0.0.6/src/bbperf/run_mode_manager_class.py +98 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/server.py +3 -5
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/tcp_control_connection_class.py +1 -1
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/udp_rate_manager_class.py +3 -3
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/util.py +10 -7
- bbperf-0.0.6/tests/run_test.sh +24 -0
- bbperf-0.0.4/README.md +0 -117
- bbperf-0.0.4/src/bbperf/calibration.py +0 -40
- bbperf-0.0.4/tests/run_test.sh +0 -25
- {bbperf-0.0.4 → bbperf-0.0.6}/.gitignore +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/DEPLOY.txt +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/LICENSE +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/.gitignore +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/__init__.py +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/data_udp_ping_sender_thread.py +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/exceptions.py +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/graph.py +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/tcp-graph.gp +0 -0
- {bbperf-0.0.4 → bbperf-0.0.6}/src/bbperf/udp-graph.gp +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bbperf
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: An end-to-end performance and bufferbloat measurement tool
|
|
5
5
|
Project-URL: Homepage, https://github.com/cloudflare/bbperf
|
|
6
6
|
Project-URL: Issues, https://github.com/cloudflare/bbperf/issues
|
|
@@ -18,27 +18,41 @@ Description-Content-Type: text/markdown
|
|
|
18
18
|
|
|
19
19
|
<p align="center"><strong>bbperf</strong> <em>- An end-to-end performance and bufferbloat measurement tool</em></p>
|
|
20
20
|
|
|
21
|
-
`bbperf` measures
|
|
21
|
+
`bbperf` measures what matters most.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* Usage of buffers between the endpoints
|
|
27
|
-
* Bufferbloat (when the usage of buffers is excessive)
|
|
23
|
+
Traditional network performance measurement tools collect metrics such as latency and throughput regardless of the conditions that exist during the collection period. While valuable for many uses, that approach can miss reporting the actual performance that real user payloads experience on production networks. This tool only reports performance metrics when the flow is operating at "max buffer usage". Max buffer usage is when the active flow has filled any and all buffers that exist along the packet path between the endpoints.
|
|
24
|
+
|
|
25
|
+
User payload is used to measure latency and throughput. This accounts for the performance impact of transparent proxies, transparent tunnels, transparent firewalls, and all the other things that are not visible to the endpoints. It also simplifies the interpretation of retransmissions on user performance, which is non-intuitive at best. This is because some retransmissions are due to the real loss of user payload while many are not. In this tool, the loss of user payload will show up in the latency and throughput metrics, i.e. higher latencies and lower throughput.
|
|
28
26
|
|
|
29
|
-
Features
|
|
27
|
+
Features:
|
|
30
28
|
|
|
31
29
|
* Latency, both unloaded and loaded, is measured by the same flow that is under test.
|
|
32
30
|
|
|
33
31
|
Other tools will commonly measure latency using a different flow or different protocol. One of the reasons why using different protocols and/or different flows is not desirable is because fair queuing will cause the latency of those other flows to be much lower (better) than the flow that matters.
|
|
34
32
|
|
|
33
|
+
* Throughput
|
|
34
|
+
|
|
35
|
+
Both sender and receiver rates are collected, but the receiver rate (a.k.a. goodput) is the important one.
|
|
36
|
+
|
|
35
37
|
* Bufferbloat is calculated
|
|
36
38
|
|
|
37
39
|
It is often assumed that TCP receive buffers are the only source of bufferbloat. While that is common, it misses many other locations where bufferbloat may occur. This tool reports the effects of all sources of bufferbloat, not just TCP receive buffers.
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
`bbperf` calculates both the BDP (bandwidth delay product) and the total amount of buffer actually used. The difference between those two is reported as "excess buffer usage". A small number for this metric is normal and expected, but a large number, relative to BDP, is bufferbloat. Bufferbloat also appears as a large difference between unloaded and loaded latency.
|
|
42
|
+
|
|
43
|
+
* Both TCP and UDP are supported
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
Both benchmark tests will wait until it has reached "max buffer usage" before collecting metrics data. For TCP, it will wait for the sending and receiving rates to match. For UDP, the sending rate will be automatically adjusted to be just above the maximum packet rate without dropping packets before starting its metrics collection.
|
|
46
|
+
|
|
47
|
+
* `bbperf` measures the performance of data flow in one direction only.
|
|
48
|
+
|
|
49
|
+
Network routing can be asymmetric, bottleneck links are asymmetric, bufferbloat is asymmetric, all of which means that performance is asymmetric. `bbperf` allows us to see the asymmetry.
|
|
50
|
+
|
|
51
|
+
Data flow in `bbperf` is one way. The direction of data flow is from the client host to the server host (unless the `-R` option is specified). That is the direction being measured, and is what is reported in the metrics.
|
|
52
|
+
|
|
53
|
+
Latency is measured round trip, but the return traffic (from the data receiver back to the data sender) is low-volume and should not contribute any bufferbloat-related latency to the measurement. This cannot be guaranteed, in the same way that it cannot be guaranteed that the unloaded latency measurement does not contain any bufferbloat-induced latency. But it does ensure that no bufferbloat-induced latency is cause by `bbperf`s own flow.
|
|
54
|
+
|
|
55
|
+
* Automatic generation of graphs
|
|
42
56
|
|
|
43
57
|
### Usage
|
|
44
58
|
|
|
@@ -56,32 +70,36 @@ To run a test:
|
|
|
56
70
|
|
|
57
71
|
`bbperf` will use port 5301 between the client and server (by default).
|
|
58
72
|
|
|
59
|
-
The first
|
|
73
|
+
The first few seconds performs a calibration, during which it captures the unloaded latency between endpoints.
|
|
60
74
|
|
|
61
75
|
The direction of data flow is from the client to the server. That is reversed when the "-R" option is specified.
|
|
62
76
|
|
|
77
|
+
The duration of this tool is non-deterministic. The time option (`-t`/`--time`) specifies how long to run _after_ valid data samples are observed. `bbperf` will automatically detect when it has enough data samples for the calibration, which establishes the unloaded latency value.
|
|
78
|
+
|
|
79
|
+
Should `bbperf` not detect any valid data samples for 60 seconds after calibration is complete, the tool will exit without results. An example of when that might happen is if the sending host is cpu constrained such that no bottleneck is created on the network.
|
|
80
|
+
|
|
63
81
|
```
|
|
64
82
|
$ bbperf.py --help
|
|
65
|
-
usage: bbperf.py [-h] [-
|
|
83
|
+
usage: bbperf.py [-h] [-s] [-c SERVER_IP] [-p SERVER_PORT] [-u] [-R] [-t SECONDS] [-v] [-q] [-J JSON_FILE] [-g] [-k]
|
|
66
84
|
|
|
67
85
|
bbperf: end to end performance and bufferbloat measurement tool
|
|
68
86
|
|
|
69
87
|
options:
|
|
70
88
|
-h, --help show this help message and exit
|
|
71
|
-
-v, --verbosity increase output verbosity (can be repeated)
|
|
72
|
-
-q, --quiet decrease output verbosity (can be repeated)
|
|
73
89
|
-s, --server run in server mode
|
|
74
90
|
-c, --client SERVER_IP
|
|
75
91
|
run in client mode
|
|
76
92
|
-p, --port SERVER_PORT
|
|
77
93
|
server port (default: 5301)
|
|
78
|
-
-R, --reverse data flow in download direction (server to client)
|
|
79
|
-
-t, --time SECONDS duration of run in seconds
|
|
80
94
|
-u, --udp run in UDP mode (default: TCP mode)
|
|
81
|
-
-
|
|
82
|
-
-
|
|
95
|
+
-R, --reverse data flow in download direction (server to client)
|
|
96
|
+
-t, --time SECONDS duration in seconds to collect valid data samples (dafault: 20)
|
|
97
|
+
-v, --verbosity increase output verbosity (can be repeated)
|
|
98
|
+
-q, --quiet decrease output verbosity (can be repeated)
|
|
83
99
|
-J, --json-file JSON_FILE
|
|
84
100
|
JSON output file
|
|
101
|
+
-g, --graph generate graph (requires gnuplot)
|
|
102
|
+
-k, --keep keep data file
|
|
85
103
|
```
|
|
86
104
|
|
|
87
105
|
Output from `bbperf` includes the following information:
|
bbperf-0.0.6/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<p align="center"><strong>bbperf</strong> <em>- An end-to-end performance and bufferbloat measurement tool</em></p>
|
|
2
|
+
|
|
3
|
+
`bbperf` measures what matters most.
|
|
4
|
+
|
|
5
|
+
Traditional network performance measurement tools collect metrics such as latency and throughput regardless of the conditions that exist during the collection period. While valuable for many uses, that approach can miss reporting the actual performance that real user payloads experience on production networks. This tool only reports performance metrics when the flow is operating at "max buffer usage". Max buffer usage is when the active flow has filled any and all buffers that exist along the packet path between the endpoints.
|
|
6
|
+
|
|
7
|
+
User payload is used to measure latency and throughput. This accounts for the performance impact of transparent proxies, transparent tunnels, transparent firewalls, and all the other things that are not visible to the endpoints. It also simplifies the interpretation of retransmissions on user performance, which is non-intuitive at best. This is because some retransmissions are due to the real loss of user payload while many are not. In this tool, the loss of user payload will show up in the latency and throughput metrics, i.e. higher latencies and lower throughput.
|
|
8
|
+
|
|
9
|
+
Features:
|
|
10
|
+
|
|
11
|
+
* Latency, both unloaded and loaded, is measured by the same flow that is under test.
|
|
12
|
+
|
|
13
|
+
Other tools will commonly measure latency using a different flow or different protocol. One of the reasons why using different protocols and/or different flows is not desirable is because fair queuing will cause the latency of those other flows to be much lower (better) than the flow that matters.
|
|
14
|
+
|
|
15
|
+
* Throughput
|
|
16
|
+
|
|
17
|
+
Both sender and receiver rates are collected, but the receiver rate (a.k.a. goodput) is the important one.
|
|
18
|
+
|
|
19
|
+
* Bufferbloat is calculated
|
|
20
|
+
|
|
21
|
+
It is often assumed that TCP receive buffers are the only source of bufferbloat. While that is common, it misses many other locations where bufferbloat may occur. This tool reports the effects of all sources of bufferbloat, not just TCP receive buffers.
|
|
22
|
+
|
|
23
|
+
`bbperf` calculates both the BDP (bandwidth delay product) and the total amount of buffer actually used. The difference between those two is reported as "excess buffer usage". A small number for this metric is normal and expected, but a large number, relative to BDP, is bufferbloat. Bufferbloat also appears as a large difference between unloaded and loaded latency.
|
|
24
|
+
|
|
25
|
+
* Both TCP and UDP are supported
|
|
26
|
+
|
|
27
|
+
Both benchmark tests will wait until it has reached "max buffer usage" before collecting metrics data. For TCP, it will wait for the sending and receiving rates to match. For UDP, the sending rate will be automatically adjusted to be just above the maximum packet rate without dropping packets before starting its metrics collection.
|
|
28
|
+
|
|
29
|
+
* `bbperf` measures the performance of data flow in one direction only.
|
|
30
|
+
|
|
31
|
+
Network routing can be asymmetric, bottleneck links are asymmetric, bufferbloat is asymmetric, all of which means that performance is asymmetric. `bbperf` allows us to see the asymmetry.
|
|
32
|
+
|
|
33
|
+
Data flow in `bbperf` is one way. The direction of data flow is from the client host to the server host (unless the `-R` option is specified). That is the direction being measured, and is what is reported in the metrics.
|
|
34
|
+
|
|
35
|
+
Latency is measured round trip, but the return traffic (from the data receiver back to the data sender) is low-volume and should not contribute any bufferbloat-related latency to the measurement. This cannot be guaranteed, in the same way that it cannot be guaranteed that the unloaded latency measurement does not contain any bufferbloat-induced latency. But it does ensure that no bufferbloat-induced latency is cause by `bbperf`s own flow.
|
|
36
|
+
|
|
37
|
+
* Automatic generation of graphs
|
|
38
|
+
|
|
39
|
+
### Usage
|
|
40
|
+
|
|
41
|
+
To run a test:
|
|
42
|
+
|
|
43
|
+
1. Start the server on one host
|
|
44
|
+
```
|
|
45
|
+
$ bbperf.py -s
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
2. Run the client on another host
|
|
49
|
+
```
|
|
50
|
+
$ bbperf.py -c <ip address of server> [additional options as desired]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`bbperf` will use port 5301 between the client and server (by default).
|
|
54
|
+
|
|
55
|
+
The first few seconds performs a calibration, during which it captures the unloaded latency between endpoints.
|
|
56
|
+
|
|
57
|
+
The direction of data flow is from the client to the server. That is reversed when the "-R" option is specified.
|
|
58
|
+
|
|
59
|
+
The duration of this tool is non-deterministic. The time option (`-t`/`--time`) specifies how long to run _after_ valid data samples are observed. `bbperf` will automatically detect when it has enough data samples for the calibration, which establishes the unloaded latency value.
|
|
60
|
+
|
|
61
|
+
Should `bbperf` not detect any valid data samples for 60 seconds after calibration is complete, the tool will exit without results. An example of when that might happen is if the sending host is cpu constrained such that no bottleneck is created on the network.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
$ bbperf.py --help
|
|
65
|
+
usage: bbperf.py [-h] [-s] [-c SERVER_IP] [-p SERVER_PORT] [-u] [-R] [-t SECONDS] [-v] [-q] [-J JSON_FILE] [-g] [-k]
|
|
66
|
+
|
|
67
|
+
bbperf: end to end performance and bufferbloat measurement tool
|
|
68
|
+
|
|
69
|
+
options:
|
|
70
|
+
-h, --help show this help message and exit
|
|
71
|
+
-s, --server run in server mode
|
|
72
|
+
-c, --client SERVER_IP
|
|
73
|
+
run in client mode
|
|
74
|
+
-p, --port SERVER_PORT
|
|
75
|
+
server port (default: 5301)
|
|
76
|
+
-u, --udp run in UDP mode (default: TCP mode)
|
|
77
|
+
-R, --reverse data flow in download direction (server to client)
|
|
78
|
+
-t, --time SECONDS duration in seconds to collect valid data samples (dafault: 20)
|
|
79
|
+
-v, --verbosity increase output verbosity (can be repeated)
|
|
80
|
+
-q, --quiet decrease output verbosity (can be repeated)
|
|
81
|
+
-J, --json-file JSON_FILE
|
|
82
|
+
JSON output file
|
|
83
|
+
-g, --graph generate graph (requires gnuplot)
|
|
84
|
+
-k, --keep keep data file
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Output from `bbperf` includes the following information:
|
|
88
|
+
```
|
|
89
|
+
sent_time time when a packet was sent
|
|
90
|
+
recv_time time when a packet was received
|
|
91
|
+
sender_pps packets per second sent
|
|
92
|
+
sender_Mbps bits per second sent
|
|
93
|
+
receiver_pps packets per second received
|
|
94
|
+
receiver_Mbps bits per second received
|
|
95
|
+
unloaded_rtt_ms unloaded RTT in milliseconds (determined during calibration)
|
|
96
|
+
rtt_ms RTT in milliseconds
|
|
97
|
+
BDP_bytes Calculated BDP in bytes
|
|
98
|
+
buffered_bytes Actual bytes in flight
|
|
99
|
+
bloat Ratio of buffered bytes to BDP
|
|
100
|
+
pkts_dropped number of packets dropped (UDP only)
|
|
101
|
+
drop% percentage of packets dropped (UDP only)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Output to standard out is controlled via the `--verbosity` and `--quiet` options as follows:
|
|
105
|
+
```
|
|
106
|
+
-qq nothing to stdout except errors
|
|
107
|
+
-q run summary in json format
|
|
108
|
+
(neither option) progress update once per second plus run summary in json format (default)
|
|
109
|
+
-v progress update once per 0.1 seconds, additional output, and run summary in json format
|
|
110
|
+
-vv debugging info useful for developers only
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Installation
|
|
114
|
+
|
|
115
|
+
`bbperf` is available via PyPI repository (pypi.org) and can be installed using pip.
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
python3 -m venv bbperf-venv
|
|
119
|
+
. bbperf-venv/bin/active
|
|
120
|
+
pip install bbperf
|
|
121
|
+
|
|
122
|
+
bbperf.py [options]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
In the event python3 is not already installed on the host:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
apt-get install python3 python3-pip (Debian/Ubuntu)
|
|
129
|
+
dnf install python3 python3-pip (Fedora/RHEL)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
Copyright (c) 2024 Cloudflare, Inc.<br/>
|
|
134
|
+
Licensed under the Apache 2.0 license found in the LICENSE file or at https://www.apache.org/licenses/LICENSE-2.0
|
|
135
|
+
|
|
@@ -14,16 +14,6 @@ def mainline():
|
|
|
14
14
|
|
|
15
15
|
parser = argparse.ArgumentParser(description="bbperf: end to end performance and bufferbloat measurement tool")
|
|
16
16
|
|
|
17
|
-
parser.add_argument("-v", "--verbosity",
|
|
18
|
-
action="count",
|
|
19
|
-
default=0,
|
|
20
|
-
help="increase output verbosity (can be repeated)")
|
|
21
|
-
|
|
22
|
-
parser.add_argument("-q", "--quiet",
|
|
23
|
-
action="count",
|
|
24
|
-
default=0,
|
|
25
|
-
help="decrease output verbosity (can be repeated)")
|
|
26
|
-
|
|
27
17
|
parser.add_argument("-s", "--server",
|
|
28
18
|
action="store_true",
|
|
29
19
|
default=False,
|
|
@@ -38,7 +28,12 @@ def mainline():
|
|
|
38
28
|
metavar="SERVER_PORT",
|
|
39
29
|
type=int,
|
|
40
30
|
default=const.SERVER_PORT,
|
|
41
|
-
help="server port (default:
|
|
31
|
+
help="server port (default: {})".format(const.SERVER_PORT))
|
|
32
|
+
|
|
33
|
+
parser.add_argument("-u", "--udp",
|
|
34
|
+
action="store_true",
|
|
35
|
+
default=False,
|
|
36
|
+
help="run in UDP mode (default: TCP mode)")
|
|
42
37
|
|
|
43
38
|
parser.add_argument("-R", "--reverse",
|
|
44
39
|
action="store_true",
|
|
@@ -48,13 +43,22 @@ def mainline():
|
|
|
48
43
|
parser.add_argument("-t", "--time",
|
|
49
44
|
metavar="SECONDS",
|
|
50
45
|
type=int,
|
|
51
|
-
default=const.
|
|
52
|
-
help="duration
|
|
46
|
+
default=const.DEFAULT_VALID_DATA_COLLECTION_TIME_SEC,
|
|
47
|
+
help="duration in seconds to collect valid data samples (dafault: {})".format(const.DEFAULT_VALID_DATA_COLLECTION_TIME_SEC))
|
|
53
48
|
|
|
54
|
-
parser.add_argument("-
|
|
55
|
-
action="
|
|
56
|
-
default=
|
|
57
|
-
help="
|
|
49
|
+
parser.add_argument("-v", "--verbosity",
|
|
50
|
+
action="count",
|
|
51
|
+
default=0,
|
|
52
|
+
help="increase output verbosity (can be repeated)")
|
|
53
|
+
|
|
54
|
+
parser.add_argument("-q", "--quiet",
|
|
55
|
+
action="count",
|
|
56
|
+
default=0,
|
|
57
|
+
help="decrease output verbosity (can be repeated)")
|
|
58
|
+
|
|
59
|
+
parser.add_argument("-J", "--json-file",
|
|
60
|
+
default=None,
|
|
61
|
+
help="JSON output file")
|
|
58
62
|
|
|
59
63
|
parser.add_argument("-g", "--graph",
|
|
60
64
|
action="store_true",
|
|
@@ -66,10 +70,6 @@ def mainline():
|
|
|
66
70
|
default=False,
|
|
67
71
|
help="keep data file")
|
|
68
72
|
|
|
69
|
-
parser.add_argument("-J", "--json-file",
|
|
70
|
-
default=None,
|
|
71
|
-
help="JSON output file")
|
|
72
|
-
|
|
73
73
|
args = parser.parse_args()
|
|
74
74
|
|
|
75
75
|
util.validate_args(args)
|
|
@@ -13,7 +13,6 @@ from . import data_udp_ping_sender_thread
|
|
|
13
13
|
from . import data_receiver_thread
|
|
14
14
|
from . import control_receiver_thread
|
|
15
15
|
from . import util
|
|
16
|
-
from . import calibration
|
|
17
16
|
from . import const
|
|
18
17
|
from . import output
|
|
19
18
|
from . import graph
|
|
@@ -79,6 +78,7 @@ def client_mainline(args):
|
|
|
79
78
|
if args.verbosity:
|
|
80
79
|
print("created data connection ({})".format("udp" if args.udp else "tcp"))
|
|
81
80
|
|
|
81
|
+
shared_run_mode = multiprocessing.Value('i', const.RUN_MODE_CALIBRATING)
|
|
82
82
|
shared_udp_sending_rate_pps = multiprocessing.Value('d', const.UDP_DEFAULT_INITIAL_RATE)
|
|
83
83
|
|
|
84
84
|
# run test
|
|
@@ -86,8 +86,6 @@ def client_mainline(args):
|
|
|
86
86
|
if args.verbosity:
|
|
87
87
|
print("test running")
|
|
88
88
|
|
|
89
|
-
calibration.start()
|
|
90
|
-
|
|
91
89
|
if not args.reverse:
|
|
92
90
|
# up direction
|
|
93
91
|
|
|
@@ -97,7 +95,7 @@ def client_mainline(args):
|
|
|
97
95
|
control_receiver_process = multiprocessing.Process(
|
|
98
96
|
name = "controlreceiver",
|
|
99
97
|
target = control_receiver_thread.run_recv_term_queue,
|
|
100
|
-
args = (args, control_receiver_stdout_queue, control_conn, control_receiver_results_queue, shared_udp_sending_rate_pps),
|
|
98
|
+
args = (args, control_receiver_stdout_queue, control_conn, control_receiver_results_queue, shared_run_mode, shared_udp_sending_rate_pps),
|
|
101
99
|
daemon = True)
|
|
102
100
|
|
|
103
101
|
control_receiver_process.start()
|
|
@@ -107,7 +105,7 @@ def client_mainline(args):
|
|
|
107
105
|
data_sender_process = multiprocessing.Process(
|
|
108
106
|
name = "datasender",
|
|
109
107
|
target = data_sender_thread.run,
|
|
110
|
-
args = (args, data_sender_stdout_queue, data_sock, server_addr, shared_udp_sending_rate_pps),
|
|
108
|
+
args = (args, data_sender_stdout_queue, data_sock, server_addr, shared_run_mode, shared_udp_sending_rate_pps),
|
|
111
109
|
daemon = True)
|
|
112
110
|
|
|
113
111
|
# test starts here
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
# Copyright (c) 2024 Cloudflare, Inc.
|
|
2
2
|
# Licensed under the Apache 2.0 license found in the LICENSE file or at https://www.apache.org/licenses/LICENSE-2.0
|
|
3
3
|
|
|
4
|
-
# defaults
|
|
5
4
|
SERVER_PORT = 5301
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
|
|
6
|
+
DEFAULT_VALID_DATA_COLLECTION_TIME_SEC = 20
|
|
7
|
+
|
|
8
|
+
# max duration for calibration phase
|
|
9
|
+
MAX_DURATION_CALIBRATION_TIME_SEC = 20
|
|
10
|
+
|
|
11
|
+
# cap the amount of time we will wait for valid data
|
|
12
|
+
MAX_DATA_COLLECTION_TIME_WITHOUT_VALID_DATA = 60
|
|
13
|
+
|
|
14
|
+
# ignore incoming data for this amount of time after starting data collection phase
|
|
15
|
+
DATA_SAMPLE_IGNORE_TIME_SEC = 1
|
|
8
16
|
|
|
9
17
|
# for socket recv()
|
|
10
18
|
BUFSZ = 4096
|
|
@@ -14,7 +22,10 @@ PAYLOAD_4K = b'a'*4096
|
|
|
14
22
|
|
|
15
23
|
SOFT_SECRET = "ZZ32gkogidrueowiruvnmxn432874ZZ"
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
RUN_MODE_CALIBRATING = 1
|
|
26
|
+
RUN_MODE_RUNNING = 2
|
|
27
|
+
RUN_MODE_STOP = 3
|
|
28
|
+
|
|
18
29
|
SAMPLE_INTERVAL_SEC = 0.1
|
|
19
30
|
STDOUT_INTERVAL_SEC = 1
|
|
20
31
|
|
|
@@ -22,6 +33,7 @@ RATE_LIMITED_BATCH_SIZE_PKTS_UDP_PKTS = 20
|
|
|
22
33
|
RATE_LIMITED_BATCH_SIZE_PKTS_TCP_PKTS = 5
|
|
23
34
|
|
|
24
35
|
START_MSG = " start "
|
|
36
|
+
UDP_STOP_MSG = "stop"
|
|
25
37
|
UDP_PING_MSG = "ping"
|
|
26
38
|
|
|
27
39
|
SOCKET_TIMEOUT_SEC=20
|
|
@@ -3,17 +3,20 @@
|
|
|
3
3
|
|
|
4
4
|
import time
|
|
5
5
|
|
|
6
|
+
from . import util
|
|
7
|
+
|
|
6
8
|
from .exceptions import PeerDisconnectedException
|
|
7
9
|
from .udp_rate_manager_class import UdpRateManagerClass
|
|
8
|
-
|
|
10
|
+
from .run_mode_manager_class import RunModeManagerClass
|
|
9
11
|
|
|
10
12
|
# direction up, runs on client
|
|
11
13
|
# args are client args (not server args)
|
|
12
14
|
# falling off the end of this method terminates the process
|
|
13
|
-
def run_recv_term_queue(args, stdout_queue, control_conn, results_queue, shared_udp_sending_rate_pps):
|
|
15
|
+
def run_recv_term_queue(args, stdout_queue, control_conn, results_queue, shared_run_mode, shared_udp_sending_rate_pps):
|
|
14
16
|
if args.verbosity:
|
|
15
17
|
stdout_queue.put("starting control receiver process: run_recv_term_queue")
|
|
16
18
|
|
|
19
|
+
run_mode_manager = RunModeManagerClass(args, shared_run_mode)
|
|
17
20
|
udp_rate_manager = UdpRateManagerClass(args, shared_udp_sending_rate_pps)
|
|
18
21
|
|
|
19
22
|
while True:
|
|
@@ -34,15 +37,33 @@ def run_recv_term_queue(args, stdout_queue, control_conn, results_queue, shared_
|
|
|
34
37
|
# exit process
|
|
35
38
|
break
|
|
36
39
|
|
|
37
|
-
received_str = bytes_read.decode()
|
|
38
40
|
curr_time_str = str(time.time())
|
|
39
|
-
new_str = received_str + curr_time_str + " d "
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
received_str = bytes_read.decode()
|
|
43
|
+
|
|
44
|
+
# the zeroes will be updated below
|
|
45
|
+
tmp_str = received_str + curr_time_str + " 0 0 0 d "
|
|
46
|
+
|
|
47
|
+
r_record = util.parse_r_record(args, tmp_str)
|
|
48
|
+
|
|
49
|
+
# updates shared_run_mode
|
|
50
|
+
# r_record["interval_dropped"]
|
|
51
|
+
# r_record["interval_dropped_percent"]
|
|
52
|
+
# r_record["is_sample_valid"]
|
|
53
|
+
run_mode_manager.update(r_record)
|
|
42
54
|
|
|
43
|
-
# udp autorate
|
|
44
55
|
if args.udp:
|
|
45
|
-
udp_rate_manager.update(
|
|
56
|
+
udp_rate_manager.update(r_record)
|
|
57
|
+
|
|
58
|
+
new_str = (received_str + curr_time_str + " " +
|
|
59
|
+
str(r_record["interval_dropped"]) + " " +
|
|
60
|
+
str(r_record["interval_dropped_percent"]) + " " +
|
|
61
|
+
str(r_record["is_sample_valid"]) + " d ")
|
|
62
|
+
|
|
63
|
+
results_queue.put(new_str)
|
|
64
|
+
|
|
65
|
+
if args.verbosity > 1:
|
|
66
|
+
stdout_queue.put("control receiver process: created: {}".format(new_str))
|
|
46
67
|
|
|
47
68
|
control_conn.close()
|
|
48
69
|
|
|
@@ -53,10 +74,11 @@ def run_recv_term_queue(args, stdout_queue, control_conn, results_queue, shared_
|
|
|
53
74
|
# direction down, runs on server
|
|
54
75
|
# args are client args (not server args)
|
|
55
76
|
# falling off the end of this method terminates the process
|
|
56
|
-
def run_recv_term_send(args, stdout_queue, control_conn, shared_udp_sending_rate_pps):
|
|
77
|
+
def run_recv_term_send(args, stdout_queue, control_conn, shared_run_mode, shared_udp_sending_rate_pps):
|
|
57
78
|
if args.verbosity:
|
|
58
79
|
stdout_queue.put("starting control receiver process: run_recv_term_send")
|
|
59
80
|
|
|
81
|
+
run_mode_manager = RunModeManagerClass(args, shared_run_mode)
|
|
60
82
|
udp_rate_manager = UdpRateManagerClass(args, shared_udp_sending_rate_pps)
|
|
61
83
|
|
|
62
84
|
while True:
|
|
@@ -77,15 +99,34 @@ def run_recv_term_send(args, stdout_queue, control_conn, shared_udp_sending_rate
|
|
|
77
99
|
# exit process
|
|
78
100
|
break
|
|
79
101
|
|
|
80
|
-
received_str = bytes_read.decode()
|
|
81
102
|
curr_time_str = str(time.time())
|
|
82
|
-
new_str = received_str + curr_time_str + " d "
|
|
83
103
|
|
|
84
|
-
|
|
104
|
+
received_str = bytes_read.decode()
|
|
105
|
+
|
|
106
|
+
# the zeroes will be updated below
|
|
107
|
+
tmp_str = received_str + curr_time_str + " 0 0 0 d "
|
|
108
|
+
|
|
109
|
+
r_record = util.parse_r_record(args, tmp_str)
|
|
110
|
+
|
|
111
|
+
# updates shared_run_mode
|
|
112
|
+
# r_record["interval_dropped"]
|
|
113
|
+
# r_record["interval_dropped_percent"]
|
|
114
|
+
# r_record["is_sample_valid"]
|
|
115
|
+
run_mode_manager.update(r_record)
|
|
85
116
|
|
|
86
|
-
# udp autorate
|
|
87
117
|
if args.udp:
|
|
88
|
-
udp_rate_manager.update(
|
|
118
|
+
udp_rate_manager.update(r_record)
|
|
119
|
+
|
|
120
|
+
new_str = (received_str + curr_time_str + " " +
|
|
121
|
+
str(r_record["interval_dropped"]) + " " +
|
|
122
|
+
str(r_record["interval_dropped_percent"]) + " " +
|
|
123
|
+
str(r_record["is_sample_valid"]) + " d ")
|
|
124
|
+
|
|
125
|
+
control_conn.send(new_str.encode())
|
|
126
|
+
|
|
127
|
+
if args.verbosity > 1:
|
|
128
|
+
stdout_queue.put("control receiver process: created: {}".format(new_str))
|
|
129
|
+
|
|
89
130
|
|
|
90
131
|
control_conn.close()
|
|
91
132
|
|
|
@@ -19,8 +19,6 @@ def run(args, stdout_queue, control_conn, data_sock, peer_addr):
|
|
|
19
19
|
|
|
20
20
|
peer_addr_for_udp = peer_addr
|
|
21
21
|
|
|
22
|
-
end_time = None
|
|
23
|
-
|
|
24
22
|
total_recv_calls = 0
|
|
25
23
|
|
|
26
24
|
interval_start_time = time.time()
|
|
@@ -69,27 +67,24 @@ def run(args, stdout_queue, control_conn, data_sock, peer_addr):
|
|
|
69
67
|
except socket.timeout:
|
|
70
68
|
pass
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if end_time and (curr_time_sec > end_time):
|
|
70
|
+
if args.udp and num_bytes_read == len(const.UDP_STOP_MSG) and (bytes_read.decode() == const.UDP_STOP_MSG):
|
|
75
71
|
if args.verbosity:
|
|
76
|
-
stdout_queue.put("data receiver thread:
|
|
77
|
-
# exit process
|
|
72
|
+
stdout_queue.put("data receiver thread: received udp stop message, exiting")
|
|
78
73
|
break
|
|
79
74
|
|
|
80
75
|
if num_bytes_read == 0:
|
|
81
76
|
# recv must have timed out, skip the rest of this loop
|
|
82
77
|
continue
|
|
83
78
|
|
|
84
|
-
|
|
79
|
+
curr_time_sec = time.time()
|
|
85
80
|
|
|
86
|
-
|
|
87
|
-
# first data packet arrived, so test just started running
|
|
88
|
-
end_time = curr_time_sec + args.time
|
|
81
|
+
total_recv_calls += 1
|
|
89
82
|
|
|
90
83
|
interval_pkts_received += 1 # valid for udp only
|
|
91
84
|
interval_bytes_received += num_bytes_read
|
|
92
85
|
|
|
86
|
+
# end of interval
|
|
87
|
+
# send interval record over control connection
|
|
93
88
|
if curr_time_sec > interval_end_time:
|
|
94
89
|
interval_time_sec = curr_time_sec - interval_start_time
|
|
95
90
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Copyright (c) 2024 Cloudflare, Inc.
|
|
2
|
+
# Licensed under the Apache 2.0 license found in the LICENSE file or at https://www.apache.org/licenses/LICENSE-2.0
|
|
3
|
+
|
|
4
|
+
import time
|
|
5
|
+
|
|
6
|
+
from . import const
|
|
7
|
+
|
|
8
|
+
class DataSampleEvaluatorClass:
|
|
9
|
+
|
|
10
|
+
# args are client args
|
|
11
|
+
def __init__(self, args0):
|
|
12
|
+
self.args = args0
|
|
13
|
+
self.valid_flag = False
|
|
14
|
+
|
|
15
|
+
# once a sample is valid then all subsequent samples are valid
|
|
16
|
+
def is_sample_valid(self, run_mode_running_start_time, dropped_this_interval_percent, sender_throughput_rate_mbps, receiver_throughput_rate_mbps):
|
|
17
|
+
if self.valid_flag:
|
|
18
|
+
return True
|
|
19
|
+
|
|
20
|
+
# samples are never valid until we have passed the "ignore time"
|
|
21
|
+
if time.time() < (run_mode_running_start_time + const.DATA_SAMPLE_IGNORE_TIME_SEC):
|
|
22
|
+
return False
|
|
23
|
+
|
|
24
|
+
throughput_rate_ratio = abs(sender_throughput_rate_mbps - receiver_throughput_rate_mbps) / receiver_throughput_rate_mbps
|
|
25
|
+
|
|
26
|
+
# udp
|
|
27
|
+
if self.args.udp and (dropped_this_interval_percent > 0):
|
|
28
|
+
self.valid_flag = True
|
|
29
|
+
return True
|
|
30
|
+
|
|
31
|
+
# tcp
|
|
32
|
+
if (not self.args.udp) and (throughput_rate_ratio < 0.01) and (receiver_throughput_rate_mbps > 1.0):
|
|
33
|
+
self.valid_flag = True
|
|
34
|
+
return True
|
|
35
|
+
|
|
36
|
+
return False
|
|
37
|
+
|