Sub topic 9
Window, RTT, and throughput calculations
This chapter assumes you know bandwidth, propagation delay, transmission delay and round-trip time (RTT). It also assumes you know that a TCP sender is limited by the receiver window (rwnd) and the congestion window (cwnd). Here you turn those limits into numbers, which is the form GATE asks for.
The one idea behind most questions
A sender can have at most one window of unacknowledged data in flight. The first acknowledgement for that data returns about one RTT after sending starts. So per RTT, the sender delivers at most one window.
- Effective window:
W = min(rwnd, cwnd) - Throughput bound:
W / RTT - Link capacity:
B - Achieved throughput:
min(B, W / RTT) - Bandwidth-delay product:
BDP = B × RTT
The BDP is how much data fits in the pipe. If W < BDP, the window limits the sender and the link sits partly idle. If W ≥ BDP, the link limits the sender.
Units: the most common source of lost marks
- Window sizes are usually in bytes, with KB meaning 1024 bytes unless the question says otherwise.
- Bandwidth is in bits per second, with Mbps meaning 10^6 bits per second.
- Convert bytes to bits (multiply by 8) before dividing by time.
- Convert milliseconds to seconds.
If the question gives a window in segments, multiply by the MSS (maximum segment size) to get bytes.
Worked example 1: a window-limited sender
A receiver advertises rwnd = 64 KB. The link is 100 Mbps and the RTT is 100 ms. Assume cwnd is larger than rwnd.
W = 65536 bytes = 524,288 bits.- Throughput bound:
524,288 / 0.1 = 5,242,880 bps, about 5.24 Mbps. BDP = 100×10^6 × 0.1 = 10^7 bits = 1,250,000 bytes.- Utilization:
65,536 / 1,250,000 ≈ 5.24%.
To fill this link, the sender needs a window of at least 1,250,000 bytes. That is far above the 65,535-byte maximum of the 16-bit window field. Filling the link therefore needs the window scale option, which multiplies the advertised value by a power of two.
Worked example 2: utilization with packet transmission time
Sliding-window questions often give packet size, bandwidth and propagation delay, and ask for utilization. Let Ttx = L / B be the time to transmit one packet. Let RTT = 2 × Tp when only the one-way propagation delay Tp is given. Ignore the acknowledgement's transmission time unless told otherwise.
One window takes Ttx per packet to send, and the first acknowledgement arrives Ttx + RTT after sending begins. So:
Utilization = min(1, W × Ttx / (Ttx + RTT))
Take a 1000-byte packet, a 1 Mbps link and an RTT of 40 ms.
Ttx = 8000 / 10^6 = 8 ms.- Window needed for 100%:
W = 1 + RTT / Ttx = 1 + 40/8 = 6packets. - With
W = 3: utilization is3 × 8 / (8 + 40) = 24/48 = 50%, so throughput is 0.5 Mbps.
Worked example 3: slow start and the window limit together
Early in a connection, cwnd is the limit and it grows. Assume cwnd starts at 1 MSS and doubles each RTT until it reaches rwnd. Assume no loss, and ignore transmission time so that one RTT equals one round.
How many RTTs does it take to send 100 segments when rwnd = 16 segments?
| RTT | cwnd (segments sent) | Total sent |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 2 | 3 |
| 3 | 4 | 7 |
| 4 | 8 | 15 |
| 5 | 16 | 31 |
| 6 | 16 | 47 |
| 7 | 16 | 63 |
| 8 | 16 | 79 |
| 9 | 16 | 95 |
| 10 | 5 (remaining) | 100 |
The answer is 10 RTTs for the data. If the question counts the handshake, add 1 RTT before the first data segment. State your assumption about that when the question is silent.
The closed form is a sum of powers of two. After k rounds of pure slow start, you have sent 2^k − 1 segments. The window stops growing once cwnd hits rwnd or ssthresh, which is why the table switches to a constant 16.
A small calculator
This script reproduces the numbers above, so you can check your hand work.
def max_throughput_bps(window_bytes, rtt_s):
return window_bytes * 8 / rtt_s
def bdp_bytes(bandwidth_bps, rtt_s):
return bandwidth_bps * rtt_s / 8
def utilization(window_bytes, rtt_s, bandwidth_bps):
return min(1.0, max_throughput_bps(window_bytes, rtt_s) / bandwidth_bps)
def rtts_to_send(total_segments, rwnd_segments):
cwnd, sent, rtts = 1, 0, 0
while sent < total_segments:
sent += min(cwnd, rwnd_segments, total_segments - sent)
rtts += 1
cwnd = min(cwnd * 2, rwnd_segments)
return rtts
print(max_throughput_bps(65536, 0.1)) # 5242880.0
print(bdp_bytes(100e6, 0.1)) # 1250000.0
print(f"{utilization(65536, 0.1, 100e6):.4%}") # 5.2429%
print(rtts_to_send(100, 16)) # 10Edge cases and gotchas
- Both windows matter. Use
min(rwnd, cwnd). A largerwnddoes not help ifcwndis still small, and the reverse is also true. - Window in segments or bytes. Slow-start questions count segments. Throughput questions need bytes. Convert with the MSS.
- Header overhead. Throughput is usually computed on data (payload) bytes. If the question counts headers, say so in your working.
- Sequence-number space. TCP numbers bytes with 32 bits. The window must stay below
2^31bytes, so sequence numbers are not reused while old segments may still be in the network. For Go-Back-N withnsequence-number bits, the maximum sender window is2^n − 1. For Selective Repeat, it is2^(n−1). - Stop-and-wait is the case
W = 1. Its utilization isTtx / (Ttx + RTT), which is the formula above withW = 1. - Ignored losses. "Maximum" or "at most" in a question means assume no loss and no extra delay. If the question includes a loss, switch to the congestion-control model from the previous chapter.
Exercises
Exercise
A link has 8 Mbps bandwidth and an RTT of 50 ms. What is the smallest window, in bytes, that lets one TCP connection use the full link?
Show answer
This is the BDP. BDP = 8×10^6 × 0.05 = 400,000 bits = 50,000 bytes. A window of at least 50,000 bytes keeps the link full.
Exercise
Packets are 1500 bytes, the link is 12 Mbps, and the RTT is 49 ms. A sliding-window sender uses a window of 10 packets. What is the link utilization?
Show answer
Ttx = 1500×8 / 12×10^6 = 1 ms. Utilization = W × Ttx / (Ttx + RTT) = 10 × 1 / (1 + 49) = 10/50 = 20%.
Exercise
A connection does not use window scaling, so the receive window is at most 65,535 bytes. The RTT is 200 ms. What is the maximum throughput, regardless of link speed?
Show answer
Throughput ≤ W / RTT = 65,535 × 8 / 0.2 = 2,621,400 bps, about 2.62 Mbps.