Packet Switching

Part of Networking

The fundamental technique that makes modern networks work: dividing data into packets and routing them independently.

Why This Matters

Packet switching is the foundational idea behind all modern data networking. The alternative — circuit switching, where a dedicated path is reserved for the duration of a communication session — works well for voice calls but is profoundly inefficient for data communication. Packet switching allows multiple communications to share the same physical infrastructure simultaneously, making networks far more cost-effective and resilient.

Understanding packet switching means understanding why networks are designed the way they are. The internet’s architecture, TCP/IP’s design, routing protocols, and congestion control all make sense in the context of packet switching. Without this foundation, networking appears as a collection of arbitrary rules; with it, the whole system has a coherent logic.

Circuit Switching vs. Packet Switching

In circuit switching (the model used by the traditional telephone network), establishing a call reserves a dedicated path from caller to receiver for the duration of the call. Every switch along the path allocates a time slot or frequency band specifically for this call. No other communication can use those resources during the call, even during the long pauses when neither party is speaking.

Circuit switching has predictable performance: the reserved bandwidth is always available, latency is constant, and packets always arrive in order. This predictability makes circuit switching ideal for voice — conversations feel natural when latency is constant and there are no dropouts.

The inefficiency of circuit switching for data is severe. Data communication is bursty: you click a link, a burst of data arrives, then nothing for several seconds while you read. During those seconds of reading, a circuit-switched connection would hold dedicated capacity on every link from server to browser, preventing those resources from being used for any other communication. Extending circuit switching to data networks would require enormous and expensive capacity that is idle most of the time.

Packet switching solves this by dividing data into packets (small chunks with headers identifying source, destination, and sequence). Each packet is transmitted independently through the network. Routers receive a packet, look at its destination address, and forward it toward the destination on whatever link is available. Multiple packets from different communications share the same link — the link is used whenever there is a packet to send, rather than being reserved regardless of whether there is data.

How Packet Switching Works

When a host wants to send data, it divides the data into packets of bounded maximum size (the MTU, typically 1500 bytes). Each packet gets an IP header with the source and destination addresses. The packets are then handed to the network for delivery.

Each router along the path receives a packet, looks up the destination address in its routing table, and forwards the packet to the next router toward the destination. Different packets in the same communication may take different paths — if one link is congested or failed, packets can be routed around it. Packets may arrive at the destination out of order, duplicated, or not at all.

The transport layer (TCP) handles the consequences of unreliable packet delivery. It numbers packets with sequence numbers, acknowledges received packets, retransmits lost packets, and reorders out-of-sequence packets before delivering data to the application. TCP provides a reliable byte stream abstraction on top of the unreliable packet delivery service of the network layer.

Store-and-forward switching is the basic model for how a router handles a packet. The router receives the entire packet, stores it in a buffer, looks up the destination in its routing table, and forwards the packet on the appropriate outbound link. The buffering is necessary because the outbound link may be busy with another packet — the arriving packet must wait until the link is available.

Queuing and Latency

Store-and-forward switching introduces queuing delay. When packets arrive faster than they can be forwarded (because the outbound link is busy or its capacity is less than the arrival rate), they queue in a buffer. The time a packet spends in this queue adds to its latency.

At low utilization, queuing delay is near zero — packets arrive and are forwarded immediately. As utilization increases, queuing delay increases. At utilization approaching 100%, queuing delay grows very rapidly because the queue fills faster than it drains. At full utilization, the queue fills completely and additional arriving packets are dropped.

This queuing behavior has important implications for network design. A lightly loaded link has excellent performance. Congestion occurs when traffic exceeds capacity, and at congestion, performance (latency and packet loss) degrades severely. This is why networks are typically designed to operate well below their theoretical capacity — the performance degradation near saturation is far worse than the average load suggests.

Head-of-line blocking is a limitation of simple FIFO queuing. If a large packet is at the head of the queue, smaller packets behind it must wait even if the smaller packets are time-sensitive. Quality of Service (QoS) mechanisms address this by maintaining multiple queues with different priority levels — voice packets get a high-priority queue and are forwarded before waiting data packets.

Packet Switching in Practice

The internet uses best-effort packet delivery. No guarantees are made about delivery time, order of delivery, or whether packets will arrive at all. This design choice is deliberate: providing guarantees would require complex reservation mechanisms and would reduce the flexibility that makes the internet resilient and efficient.

Applications that need reliability add it at the transport layer (TCP). Applications that can tolerate loss but not delay (real-time voice and video) use UDP and accept occasional packet loss as preferable to the retransmission delays of TCP.

Congestion control is TCP’s mechanism for adapting to available capacity. TCP starts slowly (slow start), increasing its transmission rate until it detects congestion (packet loss or ECN signal). It then backs off and gradually increases again. This self-regulating behavior, when followed by all TCP senders, allows the network to operate efficiently without centralized admission control.

Routing protocols discover and maintain the routing tables that routers use to make forwarding decisions. OSPF (Open Shortest Path First) and BGP (Border Gateway Protocol) are the most widely used. OSPF is used within organizations (interior routing); BGP is used between organizations and on the internet backbone (exterior routing). These protocols automatically adapt to topology changes — when a link fails, the protocols converge on new routes within seconds or minutes.

Implications for Network Design

Packet switching’s efficiency comes from statistical multiplexing — the probability that many senders all transmit simultaneously is low, so their combined average demand is much less than their combined peak demand. The shared capacity can be sized for average demand rather than peak demand, dramatically reducing cost.

This statistical efficiency depends on having many independent senders. A network serving a few large senders that transmit continuously gets little statistical benefit. A network serving many small senders who transmit in short bursts (typical office use) benefits enormously.

Understanding packet switching also explains why internet-based WAN links are cheaper than dedicated leased lines of the same bandwidth. An internet connection shares infrastructure with many other customers; a leased line is dedicated capacity. The sharing makes internet connectivity cheaper, but it also means performance is not guaranteed — busy periods may see higher latency and lower throughput than a lightly loaded leased line would provide.

For applications where consistent low latency is required (remote machine control, real-time medical monitoring), packet switching over shared internet infrastructure may not be adequate. In these cases, dedicated links, VPNs with QoS, or MPLS services that provide traffic engineering over the internet backbone may be needed to provide the consistent performance the application requires.