Reading rates honestly
Outcome: you can look at any rate bandwhich shows and say what it is safe to conclude — and what it would be a mistake to conclude. Every exhibit in this chapter is a number the lab actually watched, set against a transfer whose truth the lab knew to the byte.
The sampler, in one paragraph
bandwhich counts bytes between refreshes, about a second apart, and the figure it prints is a smoothed rate, not a stopwatch reading of the last second alone: recent seconds weigh more, earlier ones fade. Three consequences follow, and the lab met all three in its first two runs.
Ramp-up. A transfer that starts from nothing does not jump to its true rate on screen. In transcript t02, the fixture server's row climbed 168,148 → 307,042 → 359,118 → 588,652 → 973,548 bytes per second across the first five refreshes of a flow that was limited to a steady 1 MiB per second from its first byte. The screen was not wrong; it was arriving.
Overshoot and linger. In transcript
t03, the 2 MiB-per-second run's server
row peaked at 2,501,702 bytes per
second — above the hard limit the
client was enforcing — and after the
client exited, its rows did not vanish:
the process lingered with
connections: 0 while its smoothed
rate decayed (1,747,774, then
1,294,177) over following refreshes.
bandwhich keeps showing a process for a
while after its last byte, wearing a
rate that is the average's memory, not
current traffic. Before concluding a
process is still sending, check its
connection count and watch whether the
number is falling on its own.
Bursts collapse into fiction. The lab's third run is the extreme case (transcript t03, second half): the whole 10 MiB payload, delivered in 0.060 seconds, with no rate limit. The true average over that instant is enormous; the total is 10,485,760 bytes. What bandwhich printed was 4,171,467 bytes per second, repeated unchanged across four consecutive refreshes, long after nothing was moving. Neither the truth ("it already finished") nor a lie — just a smoothing window with one violent event inside it, holding the last computed figure because no new traffic arrived to change it. The lesson generalises: for anything that lives and dies inside a second or two, bandwhich can tell you that roughly this much moved, and roughly whose it was (chapter 9: in this run it could not even do that for the client). It cannot tell you the shape of the burst.
Loopback's two traps
The lab's traffic ran on loopback, and loopback teaches two lessons that apply everywhere once recognised.
Direction degenerates. Chapter 6 showed every byte of a download landing in the "up" column, download zero, because direction is decided by whether a packet's source is a local address — and on loopback both ends are local. On a real interface facing another machine, the split behaves as the labels promise: packets from the remote address count as down. But any traffic to the machine itself — local services talking to each other, a proxy on the same box — falls into the loopback pattern wherever it happens, and the safe reading is the pair of rows, not the arrows.
The same bytes are counted at both
ends. The remote-address row in t02
(974,110) was the sum of the server's
sending and the client's housekeeping,
because both ends of the conversation
live on the watched machine. The
--total-utilization run (transcript
t06) makes the same point in totals:
the server connection's cumulative
figure ended at 14,099,830 for a
10,485,760-byte payload. bandwhich
totals count attributed traffic,
counted where it is seen; they are the
right tool for "which process moved the
most" and the wrong tool for "how many
bytes was that file".
An independent witness keeps everyone
honest: /proc/net/dev counts bytes
per interface with no opinions at all.
Across one lab download its loopback
counter rose by 10,653,526 bytes
(transcript t08) — the payload, plus
headers and acknowledgements, counted
once per direction by the kernel. When
bandwhich's story and the kernel
counter's story disagree wildly, the
kernel is the one without a smoothing
window.
The rules of thumb
- Trust steady rates to within the wobble you can watch: a figure that holds within a few percent across several refreshes is a measurement.
- Distrust the first two refreshes of anything, and the last two after it stops.
- For short events, read totals and
byte counts from the programs
themselves (their own logs,
ss,/proc/net/dev), and let bandwhich answer only the question it is good at: whose name was on it. - A rate that repeats digit for digit is a held figure, not a live one. Real traffic breathes; frozen numbers are the sampler waiting for news.
Check: rerun the fixture without a rate limit and watch the burst exhibit happen on your own screen — one frozen, implausible rate, outliving the transfer. Seeing it once, on traffic you made, vaccinates you against reading it as fact on traffic you did not.