Network Protocol Compression

Header compression techniques in protocols such as IPv6, TCP, and VoIP.

The Anatomy of a Digital Packet: Why Headers Matter

To understand why compressing network protocols is so important, we must first visualize how data travels across the internet. Information does not flow in a single, continuous stream. Instead, it is broken down into millions of tiny, discrete pieces called . Each packet is like a digital envelope. Inside the envelope is a small piece of your actual data, this is the payload. But just like a real envelope, the most important part for delivery is what is written on the outside: the header.

The packet header contains all the essential control and addressing information needed to get the packet from its source to its destination and ensure the data can be reassembled correctly. For a typical internet connection using the TCP/IP suite, a single packet carries a stack of headers from different protocol layers, including:

  • IP Header (Internet Protocol): This is the main address label. It contains the source and destination IP addresses, like 192.168.1.10192.168.1.10, which act like the street addresses for the sending and receiving computers. The standard IPv4 header is 20 bytes long.
  • TCP Header (Transmission Control Protocol) or UDP Header (User Datagram Protocol): This header manages the connection between specific applications. It includes source and destination port numbers (like a specific apartment number at a street address), sequence numbers to keep track of the order of packets, and checksums for error detection. The standard TCP header is 20 bytes, and the UDP header is 8 bytes.
  • Application-Layer Headers (sometimes): Some protocols, like RTP (Real-time Transport Protocol) used for voice and video streaming, add their own header on top of TCP/UDP, containing timestamps and other synchronization information. The RTP header is typically 12 bytes.

The Problem of Protocol Overhead

The combined size of these headers is known as . In many situations, this overhead is negligible. If you are downloading a large 5 MB image, an extra 40 bytes of headers on each packet is insignificant. However, there are many modern applications where the payload is inherently very small, and this is where overhead becomes a major problem.

The classic example is Voice over IP (VoIP), the technology behind internet phone calls. To ensure a smooth, real-time conversation, audio is broken into very small chunks. A typical VoIP packet might contain only 20 or 30 bytes of audio data in its payload. Now let us calculate the header size for that packet:

IPv4聽Header聽(20聽bytes)+UDP聽Header聽(8聽bytes)+RTP聽Header聽(12聽bytes)=40bytesofheaders\text{IPv4 Header (20 bytes)} + \text{UDP Header (8 bytes)} + \text{RTP Header (12 bytes)} = \textbf{40 bytes of headers}

This is a staggering result. To send just 20 bytes of actual audio information, the network must transmit a 60-byte packet, of which 40 bytes (or 67 percent) is pure overhead. More than two-thirds of the bandwidth is being wasted just on addressing and control information. This inefficiency is especially damaging on low-bandwidth or expensive links, such as mobile data or satellite connections. It limits the number of concurrent calls, increases latency, and drains battery life on mobile devices. This is the precise problem that network protocol compression, specifically header compression, was designed to solve.

The Principle of Header Compression: Exploiting Redundancy Across Packets

Header compression works by exploiting a simple but powerful observation: within a single stream of communication (like a phone call, a video stream, or even a single file download), most of the information in the packet headers is highly repetitive.

Let us analyze the headers in a VoIP call from User A to User B:

  • Static Fields: Some fields are completely static for the entire duration of the call. The source IP address (User A's IP), the destination IP address (User B's IP), the source UDP port, and the destination UDP port will be identical in every single packet. It is extremely wasteful to send these same 40 bytes of information over and over again.
  • Predictably Changing Fields: Other fields are not static, but they change in a very predictable way. For instance, the RTP sequence number increments by exactly one with each consecutive packet. The RTP timestamp also increases by a fixed, predictable amount corresponding to the size of the audio payload.

Header compression schemes leverage this predictability. The compressor (at the sender) and the decompressor (at the receiver) establish a shared state, known as a . The process generally works like this:

  1. The first few packets of a stream are sent with full, uncompressed headers. This allows the receiver to build its local copy of the context, storing all the static information like IP addresses and port numbers.
  2. Once both sides are synchronized and share the same context, the compressor stops sending the full headers. For subsequent packets, it sends only a tiny compressed header. This compressed header does not contain the full IP addresses, but rather a small Context ID to identify which stored context to use, along with minimal information describing the changes (e.g., a single bit indicating "the sequence number increased by one").
  3. The decompressor at the receiving end gets this tiny 1-3 byte compressed header. It uses the Context ID to retrieve the stored full header, and then applies the small update (e.g., increments its stored sequence number) to perfectly reconstruct the original, full header before passing the packet up to the application.

By sending only the changes instead of the entire header each time, header compression can reduce the 40-byte overhead of a typical VoIP packet down to just 1 to 3 bytes, an efficiency gain of over 90 percent.

ROHC (Robust Header Compression): The Gold Standard

The most widely used and powerful standard for header compression today is called ROHC. The "Robust" in its name is critical; it was specifically designed to work reliably even over difficult, error-prone links like wireless and satellite networks, where packets are frequently lost or reordered.

ROHC is a sophisticated stateful protocol that defines different profiles for various types of traffic (e.g., ROHC-RTP for VoIP, ROHC-TCP for web traffic). It operates in several states to balance efficiency and robustness:

  • Initialization and Refresh (IR) State: The compressor starts in this state, sending full headers to establish or refresh the decompressor's context.
  • First Order (FO) State: Once the context is established, the compressor moves to this state. It sends compressed headers that contain updates for fields that change unpredictably or that need to be re-synchronized.
  • Second Order (SO) State: This is the most highly optimized state. Once the compressor is confident that the decompressor is fully synchronized, it sends the smallest possible headers, often containing just a compressed sequence number.

The protocol can dynamically transition between these states. If a packet is lost and the decompressor loses sync, it can signal the compressor (if a feedback channel is available) to move back to a lower state and send a more detailed update packet to re-establish the context. This robustness is what makes ROHC so effective for modern mobile communication.

Practical Application 1: IPv6 and the Internet of Things (IoT)

One of the most important modern applications of header compression is enabling the Internet of Things (IoT). The successor to IPv4, , was designed to solve the address exhaustion problem, but it came with a trade-off: larger headers. The standard IPv6 header is a fixed 40 bytes, double the size of a standard IPv4 header.

For tiny, low-power IoT devices like sensors or smart home gadgets, this 40-byte header is a massive burden, especially when the payload might only be a few bytes (e.g., a temperature reading). To solve this, a specialized standard called 6LoWPAN (IPv6 over Low-Power Wireless Personal Area Networks) was created. 6LoWPAN is a set of standards that uses aggressive header compression and other techniques to make IPv6 practical for these constrained networks. It compresses headers by:

  • Eliding Common Fields: Many fields in the IPv6 and UDP headers can be elided (omitted) and inferred from the context of the link layer.
  • Shared Prefixes: All devices on a single 6LoWPAN network share the same IPv6 network prefix. This prefix does not need to be sent in every packet; it is part of the context.
  • Address Derivation: The 64-bit interface identifier of an IPv6 address can often be derived directly from the device's 48-bit or 64-bit MAC address, eliminating the need to transmit it at all.

Through these techniques, the 48 bytes of an IPv6 and UDP header can be compressed down to as few as 2-4 bytes, making efficient IP communication possible for even the smallest of devices.

    Network Protocol Compression