net_throughput
TCP throughput from this box to a peer box: a fixed number of bytes per sample, over one or more parallel connections, checked by the peer, under a hard cap on the bytes a Run may send.
What a figure means
Each sample (repetitions 1) opens streams new connections beforehand, then, inside the
sample, every stream writes its share of bytes_per_sample and waits for the peer's reply.
The sample ends when the last reply arrives. Method runs v1's bytes per second
(bytes_per_second) is bytes_per_repetition × 10^9 divided by the median sample time:
the box-to-box throughput of streams connections, slow start included.
What a figure does not show
- Latency: see
net_rtt. - Connection setup: connections are opened before each sample.
- More than the bytes asked for: a short transfer is dominated by slow start, a long one by the instance's network allowance, and AWS lets a burst exceed the sustained baseline.
Parameters
The benchmark's Series and their figures are listed at https://api.ledgermath.com/v1/benchmarks/net_throughput.json.
| Variable | --quick default | Meaning |
|---|---|---|
LM_PARAM_SCOPE | loopback | Where the peer is (same_az, cross_az, ...); part of the Series |
LM_PARAM_STREAMS | 1 | Parallel connections per sample, 1 to 32 |
LM_PARAM_BYTES_PER_SAMPLE | 4194304 | Bytes one sample sends (capped at 4 MiB under --quick) |
LM_PARAM_MAX_TOTAL_BYTES | 268435456 | The most the whole Run may send, warmup included |
LM_PARAM_CHUNK_BYTES | 131072 | Bytes per send(), 4096 to 1048576 |
LM_PARAM_TIMEOUT_MS | 10000 | Socket timeout of every connect, send and read |
The cap is checked before any connection: one warmup sample plus LM_SAMPLES counted ones,
times bytes_per_sample, must fit under max_total_bytes, or the Run exits 2 having sent
nothing. Cross-AZ traffic is billed per gigabyte, so its parameter set keeps this small.
Service inputs: LM_SERVICE_PEER_HOST and LM_SERVICE_PEER_PORT. The peer runs
net_throughput --serve <port> [<bind address>]. Under --quick with no peer, the binary
sinks to itself on 127.0.0.1.
Observed values
| Key | What it is |
|---|---|
bytes_per_repetition | Bytes one sample sends, all streams together |
streams, chunk_bytes, warmup_samples | The shape of a sample |
max_total_bytes, planned_total_bytes | The cap, and what the Run planned under it |
peer_address, peer_port, local_address | The addresses connected |
A tcp_info event after each sample holds every stream's retransmissions, congestion
window, path MTU and RTT; work holds total_bytes_sent and streams_completed. A stream
whose share is 1 MiB or more also has a transfer_progress event after each sample (see
"How it works").
Findings
No finding of its own so far.
How it works
A stream writes [u64 magic][u64 bytes], then its bytes: the Fixture pattern at an offset
of the stream's own. The sink hashes what it reads as it reads it (a four-lane word hash,
fast enough not to be the bottleneck) and replies [u64 bytes received][u64 hash]. Every
reply is compared with the hash computed before the first sample; a mismatch exits 1, and
the replies are folded into verified.
Each stream is a new connection, so its sample holds its TCP slow start. A stream whose
share of the sample is 1 MiB or more records progress points as it sends
(benchmarks/harness/c/lm_progress.h): after each chunk_bytes send, when its bytes
(after the 16-byte header) reach the next whole step, one read of the clock
(CLOCK_MONOTONIC_RAW). The step is 1 MiB below 65 MiB, then the least power of two times
1 MiB that keeps the points at 64 or fewer: the scheduled 256 MiB on one stream has a step of
4 MiB, 64 MiB on each of four streams 1 MiB, 64 points each. After the sample's tcp_info,
one event per stream:
{"event":"transfer_progress","t":…,"sample":2,"stream":0,"bytes":268435456,
"step_bytes":4194304,"anchor":"sample_started","points":[[ns,4194304],[ns,8388608],…]}
bytes is the stream's share; each point is [ns, bytes], ns from the sample's
sample_started (anchor), so no point is past its sample_ended. A point is when send
returned, its bytes in the kernel's send buffer: the points lead the sink's reading by at
most the send buffer, and the sample's end, the sink's reply, comes after the last. The cost
inside the sample is one comparison per send and one clock read at each step, into a fixed
array of 64 points in the stream's own struct, touched before the first sample; nothing is
allocated. A failed stream ends the Run (exit 1), so no failed transfer is written. Size:
about 130 B plus about 23 B a point, at most about 1.6 KB per stream per sample, about 40 KB
for the scheduled four streams over five counted samples and the warmup.
Building and testing
make BUILD=static
./build/static/net_throughput --quick | python3 ../../scripts/check-events.py --quick
bun test tests/net-and-ec2-benchmarks.test.ts