Protocol Encapsulation: TCP vs Aeron/UDP
The raw byte overhead is nearly a wash. The behavioral difference is enormous. That is the headline of comparing a TCP/IP stack against Aeron’s UDP-based stack.
Both stacks ride the same Ethernet and IP layers. They diverge at the transport layer, and that divergence is where your tail latency lives.
Read this alongside the tuning overview and the bandwidth delay product page.
The TCP/IP Stack
Section titled “The TCP/IP Stack”Every TCP segment is wrapped in headers at each layer of the stack.
┌───────────────────────────────────────────────────────────────┐│ OSI 1: Physical — Cables, fibre, wires │├──────────┬──────────────────────────────────────┬─────────────┤│ Header │ Ethernet Payload (46-1500 bytes MTU) │ CRC ││ 14 bytes │ │ 4 bytes │├──────────┼──────────────────────────────────────┤ OSI 2 ││ IP Hdr │ IP Data Array │ ││ 20 bytes │ │ OSI 3 │├──────────┼──────────────────────────────────────┤ ││ TCP Hdr │ TCP Data Array │ ││ 20 bytes │ │ OSI 4/5 │├──────────┼──────────────────────────────────────┤ ││ HTTP ? │ Application Data │ OSI 6&7 │└──────────┴──────────────────────────────────────┴─────────────┘Overhead calculation for TCP
Section titled “Overhead calculation for TCP”For a 1500-byte MTU Ethernet frame:
- Ethernet header: 14 bytes + CRC: 4 bytes = 18 bytes
- IP header: 20 bytes
- TCP header: 20 bytes
- Total overhead: 58 bytes → leaving ~1442 bytes for application data
- Plus HTTP headers if using HTTP → even less payload
The Aeron/UDP Stack
Section titled “The Aeron/UDP Stack”Aeron keeps Ethernet and IP, swaps TCP for UDP, and replaces the application protocol with its own reliability layer.
┌───────────────────────────────────────────────────────────────┐│ OSI 1: Physical — Cables, fibre, wires │├──────────┬──────────────────────────────────────┬─────────────┤│ Header │ Ethernet Payload (46-1500 bytes MTU) │ CRC ││ 14 bytes │ │ 4 bytes │├──────────┼──────────────────────────────────────┤ OSI 2 ││ IP Hdr │ IP Data Array │ ││ 20 bytes │ │ OSI 3 │├──────────┼──────────────────────────────────────┤ ││ UDP Hdr │ Aeron Message │ ││ 8 bytes │ │ OSI 4/5 │├──────────┼──────────────────────────────────────┤ ││ Aeron Hdr│ Application Data │ ││ 24 bytes │ │ OSI 6&7 │└──────────┴──────────────────────────────────────┴─────────────┘Overhead Comparison: TCP vs Aeron/UDP
Section titled “Overhead Comparison: TCP vs Aeron/UDP”| Layer | TCP Stack | Aeron/UDP Stack |
|---|---|---|
| Ethernet | 18 bytes | 18 bytes |
| IP | 20 bytes | 20 bytes |
| Transport | TCP: 20 bytes | UDP: 8 bytes |
| Session/App | HTTP: variable (100s of bytes) | Aeron: 24 bytes |
| Total overhead | 58+ bytes (without HTTP) | 70 bytes (with Aeron header) |
Key Differences
Section titled “Key Differences”The byte counts are close. What you get for those bytes is not.
- UDP header is 8 bytes vs TCP’s 20 bytes — 12 bytes saved per packet.
- Aeron adds its own 24-byte header for reliability (sequence numbers, stream IDs, etc.).
- No TCP handshake, no TCP congestion control, no TCP head-of-line blocking.
- Aeron implements its own reliability via NAK-based retransmission — more efficient for multicast and high-throughput scenarios.
Why This Matters for Tuning
Section titled “Why This Matters for Tuning”Header bytes barely move the needle on throughput. The 12 bytes UDP saves over TCP, less the extra bytes Aeron spends on its header, is rounding error against a 1500-byte frame. So do not pick Aeron to shave a few bytes.
Pick it for the tail. TCP’s congestion control and strict in-order delivery are the real cost. They inflate p99 under load and inject variance that no buffer tweak fully removes:
- Head-of-line blocking — one lost segment stalls every later segment behind it, spiking p99 even when the network is healthy.
- Congestion control — TCP throttles the sender on its own schedule, capping throughput and adding latency you did not ask for.
- Handshakes — connection setup adds round trips before the first byte of data moves.
Aeron’s NAK-based retransmission on UDP sidesteps all three. It controls retransmission timing itself and never blocks the head of the line, which keeps p50 tight and p99 predictable.
For how Aeron’s NAK protocol, sequence numbers, and term buffers actually move these bytes, defer to The Aeron Files. This page stays focused on the stack comparison.