What is QoS
QoS (Quality of Service) is a set of techniques for controlling network latency, congestion, and packet loss so that the traffic that matters most gets treated accordingly. Ordinary, non-time-sensitive traffic — web browsing, email — generally doesn't need it. But for critical business traffic and multimedia applications, QoS is what keeps important packets from being delayed or dropped when the network gets overloaded, letting the network keep operating efficiently even under pressure.
How QoS Works
QoS works by classifying traffic, marking it with a priority, and then treating each priority level differently as packets move through the switch.
Priority marking starts outside the switch. Different traffic types carry priority information in different fields: 802.1p in VLAN frames, DSCP in IPv4 packets, traffic class in IPv6, EXP in MPLS. Layer 2 priority is the simplest case — the 3-bit PRI field inside a VLAN frame's 802.1Q tag, giving 8 priority levels. Layer 3 priority has more history behind it: the original RFC 791 ToS field used just 3 bits for IP Precedence, while the newer RFC 2474 standard repurposed that byte as the DSCP field, using 6 bits to define 64 distinct priority values (with the remaining 2 bits reserved for ECN).
When a frame enters the switch, its external priority (802.1p, DSCP, etc.) gets mapped to two internal values: a service class (also called PHB, ranging roughly 0–7, or named BE/AF1–4/CS6/CS7) and a discard priority, or "color" (green, yellow, or red). Congestion management inside the switch operates on service class; congestion avoidance operates on color. When the frame leaves, those internal values get mapped back out to an external priority so the next device downstream can make its own QoS decisions.
Congestion management decides the order in which queued packets get scheduled, using one of three algorithms:
PQ / SP (Priority Queuing / Strict Priority): services queues in strict priority order — a lower-priority queue is only scheduled once every packet ahead of it in higher-priority queues is gone. This guarantees critical traffic goes first, but lower-priority queues can starve entirely if higher-priority queues stay busy.
DWRR (Deficit Weighted Round Robin): rotates across queues by configurable weight, so each queue gets a proportional share of bandwidth even under load — avoiding PQ's starvation problem, at the cost of not guaranteeing the lowest possible latency for delay-sensitive traffic.
Hybrid (PQ + DWRR): combines both — critical, delay-sensitive traffic goes into a PQ-scheduled queue with dedicated bandwidth, while everything else is scheduled by DWRR according to weight, getting the low latency of PQ and the fairness of DWRR at once.
Congestion avoidance works differently: instead of just deciding scheduling order, it actively drops packets before a queue overflows, to keep congestion from getting worse. Traditional tail drop treats every packet equally regardless of priority once a queue is full. WRED (Weighted Random Early Detection) improves on this by assigning drop probability based on priority — as queue occupancy rises past a minimum threshold, lower-priority traffic starts getting dropped first, protecting higher-priority traffic for longer. A closely related mechanism, ECN (Explicit Congestion Notification), marks packets instead of dropping them once occupancy crosses a threshold, letting TCP endpoints back off voluntarily rather than losing data outright.
Flow shaping addresses a different problem: bursts and rate mismatches. When a downstream device's interface rate is lower than an upstream device's, or when traffic bursts unpredictably, shaping smooths the output using buffers and token buckets — caching bursts and releasing them at an even, configured rate. This can apply at the whole-interface level (limiting everything leaving a port, regardless of priority) or per-queue (shaping one specific queue differently from the rest).
Finally, PFC (Priority-based Flow Control) extends standard Ethernet PAUSE-frame flow control with priority awareness. When a specific queue's buffer occupancy crosses a high-water threshold, the switch sends a PAUSE frame just for that priority, asking the sender to pause only that traffic class — rather than pausing the whole link — and resumes once occupancy drops back below a low-water threshold. This lets a switch protect a small number of latency- and loss-sensitive queues (commonly used for storage or RDMA traffic) from ever dropping packets, without stalling everything else on the link.
Why QoS is Beneficial
Protects critical traffic under load: Voice, video, storage, and other latency-sensitive traffic keeps its performance characteristics even when the network is congested, instead of competing equally with bulk data transfers.
Prevents queue starvation while still prioritizing: Hybrid PQ+DWRR scheduling gives operators the low latency of strict priority for the traffic that truly needs it, without silently starving everything behind it.
Reduces packet loss intelligently: WRED and ECN drop or mark the least important traffic first, rather than dropping indiscriminately once a queue fills — preserving service quality for higher-priority flows during congestion.
Smooths bursty traffic: Flow shaping absorbs traffic bursts and rate mismatches between upstream and downstream devices, preventing the kind of sudden congestion that leads to dropped packets and jitter.
Enables truly lossless queues where it matters: PFC lets specific traffic classes — like storage or RDMA — get zero-packet-loss treatment without requiring the entire link to be flow-controlled.
At Asteraix