Section 18.2.18

Figure 11: useful goodput and the first-frame correction

Definition

Useful goodput is the rate, in bits per second, at which a receiver obtains the bytes the application needs. A frame is one unit of data as sent and received, and useful goodput leaves out frame headers, measurement fields such as a sequence number, duplicate frames and rejected frames. The first-frame correction applies when that rate is timed from the arrival of the first counted frame to the arrival of the last. The first frame’s bytes are then left out, because that frame had finished arriving when the timing began.

The idea

A receiver records the time at which each frame arrives. Three frames of 100 bytes arrive at 0, 10 and 20 milliseconds (ms). The obvious calculation divides all 300 bytes by the 20 ms between the first and the last arrival. But the timing started when the first frame had already arrived, so the time the link spent carrying that frame lies before the window. Inside the window are two gaps, and each gap ends with the arrival of one frame. The 20 ms paid for 2 frames, not 3.

This is the fencepost count: a straight fence with 3 posts has 2 spans between them. A window that starts and ends on an arrival contains one fewer gap than it contains arrivals. The picture treats each gap as the time the link spent on one frame. If the sender pauses, a gap also holds idle time, and the rate then includes that idle time, as a delivery rate should.

A second correction concerns the bytes themselves. Experiments often start each frame with a measurement header, such as a sequence number that lets the receiver detect lost frames. The application never asked for those bytes, so useful goodput leaves them out. All data in this entry’s examples are invented.

How it works

The computation has four steps.

  1. Decide what earns credit. State which frames count, usually those the receiver accepts, each counted the first time it arrives, and how many useful bytes each carries. For a frame of LL bytes that includes hh bytes of measurement header, the useful length is u=L−hu = L - h.

  2. Fix the window. Let NN be the number of counted frames. The window starts at the arrival of the first counted frame, at time t1t_1, and ends at the arrival of the last, at time tNt_N, both read from one clock and measured in seconds.

  3. Credit the frames that arrive inside the window. When the clock distinguishes the first arrival from the second, frames 2 to NN arrive after t1t_1 and no later than tNt_N. Frame 1 arrives exactly at the start and is not credited. If other frames share the first timestamp, exclude all of them as well. The next formula assumes the first frame alone has that timestamp.

  4. Divide, and convert bytes to bits. G=8(N−1)utN−t1bits per second.G = \frac{8\,(N - 1)\,u}{t_N - t_1}\ \text{bits per second}. If the frames differ in size, replace (N−1)u(N - 1)\,u by the sum of the useful bytes of the frames stamped strictly after t1t_1, including the right endpoint tNt_N.

The correction belongs to this window, not to goodput §7.39 in general. The rule behind it is to credit exactly the bytes whose recorded delivery falls inside the window. Suppose the window instead starts at an earlier event, read on the same clock at time t0t_0, that comes before the link begins carrying the first frame, such as a start signal that the receiver timestamps. Then all NN frames are carried inside the window, and the rate is 8Nu/(tN−t0)8 N u / (t_N - t_0). The finite-window rate §11.41 entry states the rule for any window.

Worked example

Three frames of L=100L = 100 bytes arrive at t1=0t_1 = 0, t2=0.01t_2 = 0.01 and t3=0.02t_3 = 0.02 seconds. Each frame begins with h=4h = 4 bytes of measurement header, so u=100−4=96u = 100 - 4 = 96 useful bytes. The window is 0.02−0=0.020.02 - 0 = 0.02 seconds long and contains 3−1=23 - 1 = 2 credited frames: G=8×2×960.02=15360.02=76,800bits per second.G = \frac{8 \times 2 \times 96}{0.02} = \frac{1536}{0.02} = 76{,}800\ \text{bits per second}.

Using NLNL, every frame at its full length, gives 8×3×100/0.02=2400/0.02=120,0008 \times 3 \times 100 / 0.02 = 2400 / 0.02 = 120{,}000 bits per second. That is 120,000/76,800=1.5625120{,}000 / 76{,}800 = 1.5625 times the correct value. The factor has two parts: 3/2=1.53 / 2 = 1.5 from crediting three frames to two gaps, and 100/96≈1.042100 / 96 \approx 1.042 from counting header bytes as useful; 1.5×100/96=1.56251.5 \times 100 / 96 = 1.5625.

The two errors behave differently as the run grows. With N=1001N = 1001 frames at the same spacing of 0.01 seconds, the window is 1000×0.01=101000 \times 0.01 = 10 seconds. The correct rate is 8×1000×96/10=76,8008 \times 1000 \times 96 / 10 = 76{,}800 bits per second, as before. Crediting all 1001 frames gives 8×1001×96/10=76,876.88 \times 1001 \times 96 / 10 = 76{,}876.8 bits per second, only 1001/1000=1.0011001 / 1000 = 1.001 times, or 0.1%, too high. Counting header bytes as useful still makes the rate 100/96100 / 96 times, about 4.2%, too high, however long the run.

Stated precisely

Number the counted frames 1,…,N1, \dots, N in order of arrival, with arrival times t1≤t2≤…≤tNt_1 \le t_2 \le \dots \le t_N in seconds, read from one clock. Let uiu_i be the number of useful bytes in frame ii. Write (a,b](a, b] for the half-open interval §14.12 of times after aa and up to and including bb. The window is (t1,tN](t_1, t_N], and it credits every frame with a recorded time strictly greater than t1t_1. For three 100-byte useful frames stamped 0, 0 and 1 second, only the last earns credit, giving 800 bits per second. When all timestamps tie, the duration is zero and the rate is undefined. For N≥2N \ge 2 with t2>t1t_2>t_1, G=8∑i=2NuitN−t1bits per second.G = \frac{8 \sum_{i=2}^{N} u_i}{t_N - t_1}\ \text{bits per second}.

If the frames arrive with a constant spacing of TT seconds and each carries uu useful bytes, the window is (N−1)T(N - 1)\,T long and G=8u/TG = 8u / T exactly, which is the long-run rate of the stream. The estimate 8NL/((N−1)T)8NL / ((N - 1)\,T) exceeds that rate by the factor NN−1⋅Lu\frac{N}{N - 1} \cdot \frac{L}{u}.

GG is the delivered useful goodput only if four conditions hold.

  1. One clock. Both times come from the receiver’s clock, or from two clocks whose offset and rate are known.

  2. One arrival point. Each arrival time is taken at the same point in the receiving software, for example when the application receives the frame.

  3. Distinct, accepted frames. Each counted frame was accepted and is counted once; a duplicate copy adds no useful bytes.

  4. A stated useful length. The useful bytes exclude every header and measurement field, and the report says which fields were excluded.

Limits and common mistakes

One frame gives no rate. With N=1N = 1 the window has length 0 and no frame is credited.

A short window is dominated by its edges. Suppose frames arrive in bursts of 4 frames, 1 ms apart, and each burst starts 10 ms after the previous one. The long-run rate is 4 frames per 10 ms, or 0.4 frames per ms. A window that covers one burst credits 3 frames to 3 ms, 1 frame per ms, which is 1/0.4=2.51 / 0.4 = 2.5 times the long-run rate. A window should cover many bursts, or start and end at the same point of the burst cycle, such as the first frame of a burst.

Frames that are lost and never delivered earn no credit, which is correct for a delivery rate, but the number lost belongs beside the rate. A rate computed at the receiver describes delivery. The rate at which the sender submits bytes can be higher for a while, as long as a queue between them is filling.

Averaging the rates of several trials gives every trial equal weight. Dividing the total credited bytes by the total window time weights each trial by its duration. The two answers can differ when trials differ in length; the entry on the ratio of aggregates versus aggregate of ratios §11.40 explains which question each answers.

The correction is not universal. For a window that includes the transfer of the first frame, crediting all NN frames is correct, and leaving one out would understate the rate.

Questions answered

Why not use NLNL?

NLNL, the number of frames NN times the full frame length LL in bytes, should not be used because it makes two counting errors when the time is measured from the arrival of the first frame to the arrival of the last. First, the time window credits arrivals strictly after its opening timestamp. That leaves N−1N-1 frames when only the first frame has that timestamp. If two frames tie there, both are excluded. Second, LL includes hh bytes of measurement header, such as a sequence number and a timestamp, which are not useful data; the useful length is u=L−hu = L - h.

With one frame at the opening timestamp and equal useful lengths, goodput is 8(N−1)u/(tN−t1)8\,(N - 1)\,u / (t_N - t_1) bits per second, where t1t_1 and tNt_N are the first and last arrival times in seconds and the factor 8 converts bytes to bits. For three 100-byte frames with 4-byte headers arriving at 0, 0.01 and 0.02 seconds, this gives 8×2×96/0.02=76,8008 \times 2 \times 96 / 0.02 = 76{,}800 bits per second, while NLNL gives 8×3×100/0.02=120,0008 \times 3 \times 100 / 0.02 = 120{,}000 bits per second, 1.5625 times too high. All NN useful payloads earn credit when their delivery timestamps lie strictly after the opening time and at or before the closing time.

Related entries: Finite-window rate (§11.41), Ratio of aggregates versus aggregate of ratios (§11.40), Length-prefix framing (§4.30), Throughput versus goodput (§7.39), Figure 11: BLE airtime, event capacity, and a goodput ceiling (§18.2.19), Timing endpoints and inclusive versus exclusive windows (§18.1.6).