Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
IP — The Layer Underneath  ›  Capstone Project

Link Capacity — Bandwidth, MTU and Packet Size

Link Capacity 15 minEvery link limits bytes per second through its bandwidth and bytes per packet through its MTU, so a game budgets both and keeps each datagram small enough never to be fragmented.

Link Capacity — Bandwidth, MTU and Packet Size

Every link has two limits a game server must respect: how many bytes it carries each second, and how many bytes fit in a single packet. Exceed the first and packets queue up and drop. Exceed the second and packets get chopped into pieces, and pieces are fragile.

The rule

Budget bytes per second and bytes per packet; never exceed the MTU.

Bandwidth is measured in bits per second. Network speeds are quoted in bits; files, buffers and packet sizes use bytes. Divide bits by 8 to get bytes: a 10 Mbit/s line carries 1.25 MB each second.

The MTU (maximum transmission unit) is the largest packet a link carries in one piece. Ethernet's is 1500 bytes. Some links are smaller: PPPoE, used on many home broadband lines, allows 1492, and VPNs and tunnels take a slice for their own headers. What matters is the path MTU, the smallest MTU anywhere along the path.

A packet bigger than the path MTU must be split into fragments; in IPv4 routers may do it, in IPv6 only the sender can. Fragmentation is bad news for games:

  • Losing any fragment loses the whole datagram, so a datagram split three ways is roughly three times as likely to be lost.
  • Many firewalls and home routers drop fragments outright.

So games cap the size of every datagram. IPv6 requires every link to carry packets of at least 1,280 bytes, which leaves 1,232 bytes for UDP data after the 40-byte IPv6 header and the 8-byte UDP header. That is why many games and protocols keep payloads at about 1,200 bytes or less: small enough to fit almost anywhere, tunnels included.

The shortcut

Work in two budgets. Per packet: at most about 1,200 bytes of payload. Per second: packets per second × bytes per packet × players × 8 = bits per second.

Sizing Manja Arena's outgoing trafficStep 1 of 4
  1. One snapshot

    A busy snapshot, with deltas, events and the game header, is 300 bytes. Adding 28 bytes of UDP and IPv4 headers makes 328 bytes per packet, well under the cap.

The most common slip is mixing bits and bytes, which makes an estimate wrong by a factor of 8. Write the unit next to every number.

Drills

Answer fast — trust the rule.

quick drill

On a 1500-byte Ethernet MTU, what is the largest UDP payload that fits in one IPv4 packet without fragmenting?

quick drill

How many bytes per second does a 10 Mbit/s line carry?

quick drill

A 4,000-byte IPv4 datagram is split into 3 fragments, and one fragment is lost. What does the receiving program get?

quick drill

Why do many games keep UDP payloads at about 1,200 bytes?

quick drill

Each of 16 players receives 20 packets a second of 500 bytes. Roughly how much bandwidth does that take?

Remember

  • Budget bytes per second and bytes per packet; never exceed the MTU.
  • Keep payloads at about 1,200 bytes or less; bits per second = packets per second × bytes per packet × players × 8.
  • Trap: mixing up bits and bytes, or sending datagrams big enough to fragment.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainDo the snapshots fit?

Explain how you would check whether Manja Arena's snapshots fit the network, covering both the size of each packet and the total bandwidth for one match.