Sub topic 3
End-to-end delay and the benefit of splitting a message into packets
This chapter assumes you know bits, bytes, bits per second, SI prefixes (kilo, mega, giga), and that a store-and-forward router receives a whole packet before it sends that packet on.
Splitting a message into packets
A message sent as one unit must finish crossing each link before the next link starts. Splitting it into packets lets the links work as a pipeline. For N links and P packets, the delay is (N + P - 1) × L/R, where L is the packet size in bits and R is the link rate.
import math
def message_delay(message_bits, packet_bits, rate_bps, links):
"""Store-and-forward delay for a message split into equal packets.
Propagation, queuing and header overhead are ignored."""
packets = math.ceil(message_bits / packet_bits)
return round((links + packets - 1) * packet_bits / rate_bps, 6)
print(message_delay(1_000_000, 1_000, 1_000_000, 3)) # 1.002 s
print(message_delay(1_000_000, 1_000_000, 1_000_000, 3)) # 3.0 sBandwidth, throughput and the bottleneck link
Bandwidth is the capacity of one link. Throughput is the rate at which data actually arrives. On a path, throughput is limited by the slowest link. A path with 100 Mbps, 10 Mbps and 1 Gbps links delivers at most 10 Mbps.
Bandwidth-delay product and data in flight
The bandwidth-delay product (BDP) is R × RTT, the number of bits that can be in transit during one round trip. For 100 Mbps and a 20 ms round-trip time, BDP = 100 × 10^6 × 0.020 = 2,000,000 bits, or 250,000 bytes. A sender must keep about this much data in flight to fill the link.
Utilization and why queues grow
Utilization ρ is the arrival rate divided by the service rate. In the common M/M/1 model, the mean queue length is ρ/(1 - ρ). That gives 1 packet at ρ = 0.5, 9 packets at ρ = 0.9, and 99 packets at ρ = 0.99. Queues grow sharply as load approaches capacity.
Stop-and-wait utilization and window sizing
Stop-and-wait sends one frame and waits for its acknowledgement. Its utilization is U = (L/R) / (L/R + RTT).
def stop_and_wait_utilization(packet_bits, rate_bps, rtt_s):
transmission = packet_bits / rate_bps
return transmission / (transmission + rtt_s)
print(round(stop_and_wait_utilization(12_000, 100_000_000, 0.020), 5)) # 0.00596With 12,000-bit frames on the 100 Mbps link, U is about 0.6%. To keep the link busy, the window W must satisfy W × L/R ≥ RTT + L/R. Here that requires W ≥ 168 frames.
Exercise
A 500,000-bit message is split into 500-bit packets and crosses 4 links of 1 Mbps each. What is the store-and-forward delay, ignoring propagation?
Show answer
There are 1000 packets, so the delay is (4 + 1000 - 1) × 500 / 10^6 = 1003 × 0.0005 = 0.5015 s.