Sub topic 11
End-to-end delay and the benefit of splitting a message into packets
This chapter assumes you know the four delay components (processing, queuing, transmission, propagation) and the idea of store-and-forward switching. Here you combine them into a formula for a whole path. You then see why cutting a message into packets makes delivery faster, and why cutting it into too many packets makes delivery slower again.
The store-and-forward model
A store-and-forward router receives a whole packet before it sends the first bit onward. So every link on the path re-sends the full packet, and the transmission delay L/R is paid once per link. L is the packet length in bits and R is the link rate in bits per second.
Propagation delay is different. It depends on how far the signal travels and how fast it moves in the medium (d/s). Summed over all links, it equals total distance divided by propagation speed when every link uses the same medium. It does not multiply with the number of links.
For one packet over k links, with queuing and processing ignored:
delay = k * (L / R) + (total distance / propagation speed)A path with k links has k - 1 routers between the end hosts. This is the most common counting mistake. The transmission term uses k, the number of links. It does not use k - 1, the number of routers.
def end_to_end_delay(packet_bits, rate_bps, links, distance_m, prop_speed_mps):
"""Store-and-forward delay of one packet; queuing and processing ignored."""
transmission = packet_bits / rate_bps # time to push the packet onto one link
propagation = distance_m / prop_speed_mps # total signal travel time
return links * transmission + propagation
# 12000-bit packet, 10 Mbps links, 3 links, 3000 km of cable at 2e8 m/s
print(round(end_to_end_delay(12_000, 10_000_000, 3, 3_000_000, 2e8), 6)) # 0.0186The numbers break down as follows:
- Transmission per link: 12,000 / 10,000,000 = 1.2 ms.
- Three links: 3.6 ms.
- Propagation: 3,000,000 / 200,000,000 = 15 ms.
- Total: 18.6 ms.
If queuing or processing delays are given, add them per router. GATE questions usually state "ignore queuing and processing", so the formula above is enough.
Sending the message as one unit
Suppose a message of M bits is sent as a single unit, which is message switching. Each of the k links must transmit all M bits before the next link can start. The delay is k * M / R, ignoring propagation.
With M = 1,000,000 bits, R = 1 Mbps and k = 3, the delay is 3 s. While link 2 transmits, link 1 and link 3 sit idle. Most of the network's capacity is wasted.
Splitting the message into packets
Now cut the message into n equal packets of P = M / n bits. The first packet crosses link 1, then link 2, then link 3. While the first packet is on link 2, the second packet can already use link 1. After a start-up period, all links work at the same time. This is a pipeline.
Count in units of one packet transmission time T = P / R:
- The first packet needs
kslots to reach the destination. - Each later packet arrives one slot after the previous one.
- The last packet arrives after
k + (n - 1)slots.
delay = (k + n - 1) * P / RThe function below applies the formula. Setting the packet size equal to the message size makes n = 1, which gives the unsegmented case.
import math
def message_delay(message_bits, packet_bits, rate_bps, links):
"""Time to deliver a message split into equal packets over store-and-forward links.
Propagation, queuing and header overhead are ignored."""
packets = math.ceil(message_bits / packet_bits)
return (links + packets - 1) * packet_bits / rate_bps
# 1,000,000-bit message, 1000-bit packets, 1 Mbps links, 3 links
print(message_delay(1_000_000, 1_000, 1_000_000, 3)) # 1.002 (segmented)
print(message_delay(1_000_000, 1_000_000, 1_000_000, 3)) # 3.0 (sent as one unit)Segmentation cuts the delay from 3 s to 1.002 s. The limit as n grows is M / R, which is 1 s here: the time to push the whole message through one link. The extra (k - 1) * P / R is the cost of filling the pipeline, and it shrinks as packets get smaller.
Where the pipeline formula applies
- All links must have the same rate. With unequal rates, the slowest link sets the pace and the formula changes (see the bottleneck chapter).
- Each packet is assumed to be sent as soon as the link is free. Queuing from other traffic is ignored.
- Propagation delay is added once, as a separate term, and it does not change with
n. - If the message does not divide evenly, the last packet is smaller. The ceiling in the code treats it as full size, so the result is a slight overestimate. Exam questions usually choose numbers that divide evenly.
Adding propagation and header overhead
The full expression for equal links, with header size h bits per packet, payload p bits and n = ceil(M / p), is:
delay = (k + n - 1) * (p + h) / R + total propagationHeaders add h bits to every packet. This creates a trade-off:
- Small packets reduce pipeline fill time, because
(k - 1)slots are each short. - Small packets also mean more packets, so more header bits are sent in total.
Ignoring the ceiling and treating n = M / p, the delay (without propagation) is proportional to (k - 1 + M/p)(p + h). Expanding gives (k-1)p + (k-1)h + M + Mh/p. Setting the derivative with respect to p to zero gives (k - 1) = Mh / p², so:
p_optimal = sqrt(M * h / (k - 1))Here k - 1 is the number of routers.
Take M = 40,000 bits, h = 100 bits, k = 5 links (4 routers), R = 1 Mbps. The optimum is sqrt(40,000 * 100 / 4) = 1000 bits.
import math
def delay_with_headers(message_bits, payload_bits, header_bits, rate_bps, links):
packets = math.ceil(message_bits / payload_bits)
return (links + packets - 1) * (payload_bits + header_bits) / rate_bps
for payload in (500, 1000, 2000):
print(payload, round(delay_with_headers(40_000, payload, 100, 1_000_000, 5), 4))
# 500 0.0504
# 1000 0.0484
# 2000 0.0504| Payload (bits) | Packets `n` | Packet size (bits) | Slots `k + n - 1` | Delay at 1 Mbps |
|---|---|---|---|---|
| 500 | 80 | 600 | 84 | 50.4 ms |
| 1000 | 40 | 1100 | 44 | 48.4 ms |
| 2000 | 20 | 2100 | 24 | 50.4 ms |
Both smaller and larger payloads are slower than the optimum. In a GATE question, check whether the problem asks for the best packet size. If it does, use the square-root formula and then confirm that M / p is a whole number.
Common errors
- Counting routers instead of links. The transmission term is
k * L / R, wherekis the number of links. - Multiplying propagation by the number of links. Total propagation is total distance over speed. If links have different lengths or media, sum each link's
d_i / s_i. - Forgetting the pipeline. Writing
n * k * P / Rfor a segmented message treats each packet as if it travelled alone. The correct count isk + n - 1slots. - Mixing units. Check Mbps against bits and MB against bytes. 1 MB is 8,000,000 bits. Kilometres must become metres, and milliseconds must become seconds.
- Leaving out headers. If a question gives a header size, every packet carries it. The message payload is split first, then each packet grows by
h. - Ignoring acknowledgements. A one-way delay needs no ACK term. Add the return trip only if the question asks for round-trip time or a protocol that waits for an ACK.
Exercises
Exercise
A message of 12,000 bits travels over 3 links (2 routers), each at 1 Mbps. Ignore propagation, queuing, processing and headers. Find the delay when the message is sent as one unit, and when it is split into 6 equal packets.
Show answer
One unit: 3 12,000 / 1,000,000 = 0.036 s (36 ms). Six packets of 2,000 bits: (3 + 6 - 1) 2,000 / 1,000,000 = 8 * 0.002 = 0.016 s (16 ms).
Exercise
A 48,000-bit message goes over 4 links (3 routers) at 1 Mbps. Each packet carries a 250-bit header. Find the payload size that minimizes delay, then the delay (ignore propagation).
Show answer
p = sqrt(M h / (k - 1)) = sqrt(48,000 250 / 3) = sqrt(4,000,000) = 2,000 bits. Packets: 48,000 / 2,000 = 24. Packet size: 2,250 bits. Slots: 4 + 24 - 1 = 27. Delay: 27 * 2,250 / 1,000,000 = 0.06075 s, about 60.75 ms.
Exercise
A 1,500-byte packet crosses 5 links of 100 Mbps each. The total cable length is 2,000 km and signals travel at 2 * 10^8 m/s. Ignoring queuing and processing, what is the one-way delay?
Show answer
Packet size is 12,000 bits. Transmission per link: 12,000 / 100,000,000 = 0.12 ms. Five links: 0.6 ms. Propagation: 2,000,000 / 200,000,000 = 10 ms. Total: 10.6 ms.