networkquality-rs is a collection of tools for measuring the quality of a
network. This repo provides a CLI tool mach which can be used to run multiple
different tests. The main focus of mach and this repo is to implement the IETF
draft: "Responsiveness under Working Conditions".
The draft defines "responsiveness", measured in Round trips Per
Minute (RPM), as a useful measurement of network quality. mach's default
operation is to measure the responsiveness of a network using Cloudflare's
responsiveness servers.
First, install rust.
Then build and run the binary at ./target/release/mach:
cargo build --release
# run an rpm test
./target/release/machOr install it with cargo:
cargo install --path ./cli
# run an RPM test
machmach defaults to running a responsiveness test when given no arguments, the
equivalent to mach rpm.
Use mach help to see a list of subcommands and mach help <subcommand> or
mach <subcommand> help to see options for that command.
Running a responsiveness test:
mach rpm
{
"unloaded_latency_ms": 10.819,
"jitter_ms": 6.945,
"download": {
"throughput": 104846062,
"loaded_latency_ms": 86.936,
"rpm": 446
},
"upload": {
"throughput": 48758784,
"loaded_latency_ms": 206.837,
"rpm": 433
}
}RPM reports are automatically uploaded to Cloudflare's aim database and are anonymous. See https://blog.cloudflare.com/aim-database-for-internet-quality/ for more information.
Use
--disable-aim-scoresto disable uploading reports.
Running a responsiveness test with Apple's server:
mach rpm -c https://mensura.cdn-apple.com/.well-known/nqTiming the download of a resource:
mach download https://cloudflare.com/cdn-cgi/trace
{
"dns_time": 0.0,
"time_connect": 0.078,
"time_secure": 0.243,
"time_body": 0.0,
"time_total": 0.243,
"bytes_total": 228,
"throughput": 7476
}Measuring latency using TCP connection timing:
mach rtt
{
"jitter_ms": 2.949,
"latency_ms": 10.549
}mach respects RUST_LOG env variables. If you want (likely too much)
information on what's happening internally, run mach with RUST_LOG=info set.
RUST_LOG=info machThe main complexity in the repo is due to the Network and Time trait
abstractions. We need those abstractions for two reasons. First, it allows us to
abstract over the underlying request/response implementation which will help
with WASM/browser support in the future. Second, we use the network abstraction
to define a Proxy network. This allows us to not only directly test H1, H2, or
H3 connections, but also to test the impact of a multi-hop proxy network. The
network trait is built in composable manner; multiple proxy networks can be
layered on each other to build any proxy configuration.
networkquality-rs is split into multiple crates are under the ./crates
directory. They are combined together to form the mach cli under ./cli.
-
nq-core: the core crate which defines theTimeandNetworkabstractions. It also provides functionality for creating and driving H1 and H2 connections over an abstracted IO transport:ByteStream. Finally, it provides a low-level HTTPClientused to send arbitrary HTTP requests as well as aThroughputClientwhich uses a specialCountingBodyto measure the throughput of an HTTP connection. -
nq-tokio-network: aNetworkimplementation based on tokio (and indirectly on hyper). -
nq-proxy-network: aNetworkimplementation that wraps another network. To create a new connection for users, theProxyNetworksendsCONNECTrequests over the inner, wrappedNetworkto the configured proxy server. This is currently unused, however will be added in the future. -
nq-stats: providesTimeseriesandCountertypes for storing measurements and running simple statisitcs on those series. -
nq-rpm: a speedtest which implements the "Responsiveness under Working Conditions" draft. -
nq-latency: a speedtest which measures latency by timing how long it takes to setup multiple TCP connections. -
nq-load-generator: provides aLoadGeneratorimplementation used to create load saturated network conditions.
- implement upload command.
- uploading a given number of bytes.
- uploading arbitrary files.
- time DNS resolution.
- better TUI experience for all commands.
- QUIC support.
- MASQUE proxying support.
- support RPK TLS.
- Output format:
- JSON
- determine stability / extensions.
- Human output
- JSON
- send AIM score reports
- automated testing
- latency comparisions with curl
- RPM comparisions with different tools against the same server
- review/better test statistics
- socket stats for measuring connection throughput
- RPM stability decreases as interval duration decreases. Look into
calculating a better
CountingBodyupdate rate. - Properly signal the connections on a network to shutdown.