Quality of Service for interviews: IntServ vs DiffServ, classification & marking (DSCP/802.1p/MPLS TC), PHBs (EF/AF/CS), queuing (LLQ/CBWFQ), WRED/ECN, policing vs shaping, and MPLS DiffServ tunneling modes.
QoS is how a congested link decides whose packets wait and whose get dropped. On an uncongested link it does nothing — queues are empty. The whole discipline is about managing the queue that forms when demand briefly exceeds the egress rate: classify traffic, mark it, and give each class the latency, loss, and bandwidth it needs.
| Model | Idea | Scaling |
|---|---|---|
| Best-effort | No differentiation; FIFO. | Trivial, no guarantees. |
| IntServ | Per-flow reservations signalled with RSVP. | Per-flow state — doesn't scale in the core. |
| DiffServ | Mark packets into a few classes; each router applies a per-hop behavior. | Stateless per-flow — the model everyone actually deploys. |
Classify once at the edge, mark the header, and trust the mark downstream. The mark lives at different layers:
| Marking | Where | Bits |
|---|---|---|
| DSCP | IPv4 ToS / IPv6 Traffic Class | 6 bits (64 values) — the primary L3 marker |
| IP Precedence | Top 3 bits of the old ToS byte | Legacy; DSCP superset |
| 802.1p (PCP) | 802.1Q VLAN tag | 3 bits (8 CoS) — L2 only |
| MPLS TC (EXP) | MPLS label | 3 bits — QoS across an MPLS core |
Trust boundary: decide where you believe incoming marks. Untrusted access ports get re-marked (or set to 0); trusted uplinks keep the DSCP. This stops a host from marking its own traffic EF and stealing the priority queue.
| PHB | DSCP | For |
|---|---|---|
| EF (Expedited Forwarding) | 46 | Voice / low-latency — strict priority, policed. |
| AFxy (Assured Forwarding) | AF11…AF43 | 4 classes (x) × 3 drop precedences (y) — video, business apps. |
| CSx (Class Selector) | CS0–CS7 | IP-Prec-compatible; CS6/7 for control plane/routing. |
| BE / Default | 0 | Everything else. |
AF drop precedence matters at congestion: within a class, higher-drop-precedence packets (e.g. AF13) are discarded before lower (AF11) — how a policer marks "in-contract" vs "out-of-contract" traffic.
Each egress class gets a queue; the scheduler decides service order:
| Policing | Shaping | |
|---|---|---|
| Excess traffic | Dropped (or re-marked) | Buffered & sent later |
| Effect on rate | Hard cap, bursty output | Smooths to the rate |
| Latency | None added | Adds delay/jitter (queue) |
| Direction | In or out | Egress |
Both use a token bucket: rate = CIR, burst = Bc (+ Be / PIR for two-rate). Tokens accumulate at CIR; a packet is conforming if tokens are available.
When IP is tunneled in MPLS, how does the label's TC relate to the inner DSCP on push/pop?
For HFT, "QoS" often means the opposite of buffering: you want minimum queue depth. Strict priority for the trading class, tiny buffers, cut-through switching, and no shaping — because a shaped queue is added latency. See Low-Latency & Trading.