← Interview Prep

QoS — Theory

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.

The three models

ModelIdeaScaling
Best-effortNo differentiation; FIFO.Trivial, no guarantees.
IntServPer-flow reservations signalled with RSVP.Per-flow state — doesn't scale in the core.
DiffServMark packets into a few classes; each router applies a per-hop behavior.Stateless per-flow — the model everyone actually deploys.

Classification & marking

Classify once at the edge, mark the header, and trust the mark downstream. The mark lives at different layers:

MarkingWhereBits
DSCPIPv4 ToS / IPv6 Traffic Class6 bits (64 values) — the primary L3 marker
IP PrecedenceTop 3 bits of the old ToS byteLegacy; DSCP superset
802.1p (PCP)802.1Q VLAN tag3 bits (8 CoS) — L2 only
MPLS TC (EXP)MPLS label3 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.

Per-Hop Behaviors (the standard DSCP classes)

PHBDSCPFor
EF (Expedited Forwarding)46Voice / low-latency — strict priority, policed.
AFxy (Assured Forwarding)AF11…AF434 classes (x) × 3 drop precedences (y) — video, business apps.
CSx (Class Selector)CS0–CS7IP-Prec-compatible; CS6/7 for control plane/routing.
BE / Default0Everything 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.

Queuing & scheduling

Each egress class gets a queue; the scheduler decides service order:

Congestion avoidance

Policing vs shaping

PolicingShaping
Excess trafficDropped (or re-marked)Buffered & sent later
Effect on rateHard cap, bursty outputSmooths to the rate
LatencyNone addedAdds delay/jitter (queue)
DirectionIn or outEgress

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.

QoS across an MPLS core (tunneling modes)

When IP is tunneled in MPLS, how does the label's TC relate to the inner DSCP on push/pop?

The low-latency/trading angle

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.

Likely interview questions

Related: Low-Latency & Trading · MPLS Theory.