Use the Same TCP MTU as Your ISP
If you’re talking in the same size packets as your ISP, there will be less time spent splitting up packets or putting them back together.
The maximum IP packet size is 64KB, so most HTTP transfers could fit easily in a single packet, given that the average HTTP transfer is 10KB. This does not mean that only one packet gets sent per request or reply; the TCP setup and teardown are complex and requires multiple packet exchanges. In addition, most web servers use Ethernet connections to their router. Ethernet has a frame size limit of 1500 bytes, forcing larger IP packets to be broken up into 1500-byte fragments.
Even with a 1500-byte limit, packets are subject to fragmentation into yet smaller pieces to fit routers along the path with a maximum transmission unit (MTU) of less than 1500 bytes or to reach clients with an MTU of less than 1500 bytes. The IP header and TCP header are both 20 bytes, so the maximum TCP data segment can be only the MTU—40 without fragmentation. Fragmentation slows a transfer because the originator has to resend in smaller chunks, and because fragments have to be reassembled into a coherent whole at the client. A well-tuned intranet will have the same MTU from end to end, but there is not much you can do about small MTUs on the Internet as a whole. When a packet size exceeds the MTU of the sender, it must be broken up and re-sent as multiple packets.
You can get the source code for a version, of traceroute that finds MTUs along ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access