Section 11.41

Finite-window rate

Definition

A finite-window rate is the amount of something counted inside a stated time interval, divided by the length of that interval: for example, the bytes delivered between two clock readings 2 seconds apart, divided by 2 seconds. The interval is called the window. The rate is defined only once three things are fixed: the event that earns credit (for data, submission, transmission, acknowledgment or delivery), the events that mark the window’s start and end, and the clock that times them. It describes that window only.

The idea

An application on a sending device hands 200 bytes to its communication software during one second. By the end of that second the receiving application has obtained only 50 of them; the other 150 are still waiting in the sender’s queue. Asked for the data rate in that second, one person answers 200 bytes per second and another answers 50. Both counted correctly. They credited the bytes at different events: one when the bytes were submitted, the other when they were delivered.

A window cuts a continuous flow at two instants, and some work is in progress at each cut. A count taken where data enter the system and a count taken where data leave it differ by the change in the amount in progress. A toll road is a fair picture: in one hour the entry gate and the exit gate count different numbers of cars, and the difference is the change in the number of cars on the road. The longer the window, the smaller this edge effect is compared with the total. The picture stops being accurate in one respect: a car never splits in two, but a network may send the same bytes twice after a loss, so the link can carry more bytes than are delivered even when nothing is in progress.

How it works

Step 1: choose the crediting event. For data passing through a communication system, the usual choices are:

Step 2: fix the window. Name the events that start and end it and the clock that times them. A monotonic clock §9.35, one that never jumps backwards when the time of day is corrected, avoids negative or stretched intervals. State whether setup, warmup §11.27, idle gaps and the final drain, the time spent finishing work already started, lie inside the window.

Step 3: count with a cumulative counter. A cumulative counter only ever increases: it holds the total credited since some starting point. Read it at the start and at the end of the window and subtract. The final reading alone includes everything credited before the window began.

Step 4: divide by the window length and give the unit: bytes per second, or, after multiplying by 8, payload bits per second.

Step 5: account for the edges. Record how much work was in progress at the start and at the end of the window. In a system that neither loses data for good nor delivers it twice, the bytes delivered in the window equal the bytes submitted in the window, plus the bytes in progress at the start, minus the bytes in progress at the end.

Worked example

A window of 1 second (s) starts with nothing in progress. During it, the sending application submits 200 bytes. The first packet, carrying 50 payload bytes and a 5-byte header, is lost on the link; the sender transmits it again, and the second copy arrives. The receiving application obtains those 50 bytes before the window ends. The receiver’s acknowledgment reaches the sender 0.2 s after the window ends. The other 150 bytes wait in the sender’s queue. Four counting rules give four rates:

The edge rule of step 5 checks the delivered count: 200+0−150=50200 + 0 - 150 = 50 bytes, which matches. No rule is wrong. Each measures a different event, and only the delivered rate measures useful data received.

A delivered-bytes counter reads 1,000 at time 10 s and 1,600 at time 12 s. The window holds 1600−1000=6001600 - 1000 = 600 bytes over 12−10=212 - 10 = 2 s, a rate of 600/2=300600 / 2 = 300 bytes per second. Dividing the final reading by the window length, 1600/2=8001600 / 2 = 800 bytes per second, wrongly credits the window with the 1,000 bytes delivered before it began.

Stated precisely

Let B(t)B(t) be the cumulative count of units credited before time tt, where a unit is whatever is counted (a byte, a message) and every time is read from one clock. For a window that starts at t0t_0 and ends at t1t_1, with t1>t0t_1 > t_0, the finite-window rate λ\lambda (lambda) is λ=B(t1)−B(t0)t1−t0.\lambda = \frac{B(t_1) - B(t_0)}{t_1 - t_0}. The numerator counts exactly the units credited at times tt with t0≤t<t1t_0 \le t < t_1, so adjacent windows that share an endpoint count every unit once.

Let S(t)S(t) and D(t)D(t) be the cumulative counts of submitted and delivered units, in a system where no unit is lost for good or delivered twice, and let Q(t)=S(t)−D(t)Q(t) = S(t) - D(t) be the number of units in progress. Taking differences at the two edges gives D(t1)−D(t0)t1−t0=S(t1)−S(t0)t1−t0−Q(t1)−Q(t0)t1−t0.\frac{D(t_1) - D(t_0)}{t_1 - t_0} = \frac{S(t_1) - S(t_0)}{t_1 - t_0} - \frac{Q(t_1) - Q(t_0)}{t_1 - t_0}. If the number of units in progress never exceeds QmaxQ_{\max}, the delivered rate and the submitted rate differ by at most Qmax/(t1−t0)Q_{\max} / (t_1 - t_0). With at most 150 bytes in progress, a 1 s window allows a gap of up to 150 bytes per second, and a 100 s window a gap of at most 1.5 bytes per second.

These statements assume one clock for all readings, counters read at the instants t0t_0 and t1t_1, and counters that do not wrap around to zero during the window.

Limits and common mistakes

A rate is an average over the window. It says nothing about bursts inside the window, about the delay of individual requests, or about whether several senders shared the link fairly.

Short windows magnify timing error. A clock that ticks once per millisecond (ms) measures any interval only to within 1 ms, which is up to 10% of a 10 ms window. The counter quantization §11.35 entry explains this rounding.

A counter of fixed width wraps around. A 32-bit byte counter returns to zero after 232=4,294,967,2962^{32} = 4{,}294{,}967{,}296 bytes. Subtracting two readings modulo 2322^{32}, that is, adding 2322^{32} when the difference is negative, gives the right count only if fewer than 2322^{32} bytes were credited during the window.

Choosing the window after looking at the data, for example the 10 seconds with the highest rate, reports a maximum, not a typical rate. Fix the window rule, including any removal of a warmup period, before the results are seen.

Rates from consecutive windows of one run are not independent observations: the work left in progress at the end of one window starts the next.

Long-run results such as Little’s law §14.39 [88] (the average number of items in a system equals the arrival rate times the average time an item spends there) describe averages over long periods. Over a short window the edge terms above are not negligible.

An unchanged delivered rate does not show an unchanged processor cost. If the link limits the rate, extra computation per byte can hide in idle processor time until the link becomes faster. The entry on computational versus communication bottleneck §14.37 treats this.

Questions answered

Are bytes counted when submitted, transmitted, acknowledged, or delivered?

Bytes can be counted at any of the four events, and a report must state which, because each event defines a different rate for the same traffic. Counting at submission measures the offered load: what the sending application asked the system to carry. Counting at transmission measures use of the link and can include protocol headers and retransmitted copies. Counting at acknowledgment measures what the sender knows has reached the receiver’s communication software. Counting at delivery measures goodput: the useful bytes that reached the receiving application, each counted once. For a claim about useful service, count at delivery.

In a 1-second window in which 200 bytes are submitted, two copies of one 55-byte packet are transmitted, no acknowledgment has yet returned and 50 bytes are delivered, the four rates are 200, 110, 0 and 50 bytes per second. Use the chosen event consistently in the counter, the plot axis and the text; take the difference of a cumulative counter across the window; and record the bytes in progress at both edges, which explain the gap between counts made at different events.

Related entries: Estimand and estimator (§11.2), Ratio of aggregates versus aggregate of ratios (§11.40), Computational versus communication bottleneck (§14.37), Little’s law (§14.39), Throughput versus goodput (§7.39), Counter quantization (§11.35). Further reading: [88].