Classify first, then queue, then schedule
Every packet that leaves a WAN edge passes the same sequence. It is classified, which gives it a forwarding class from its DSCP, an access list match or an application list. The class selects a queue. A scheduler picks which queue sends next. A shaper holds the whole interface to the rate of the circuit, so that the queues, not the provider, decide what waits. The earlier lesson covered the marks. This one covers what the edge does with them.
Classify the packet, map the class to a queue, let the scheduler choose the next queue, and let the shaper hold the interface to the circuit rate.
- ClassifyDSCP, ACL,application
- Classforwardingclass
- Queueone queueper class
- Schedulewho sendsnext
- Shapecircuit rate
On a link below its rate, packets leave at once and the scheduler changes nothing. When the link reaches its rate, packets wait and the scheduler decides the order.
Priority and weighted queues
Two scheduling styles are used together. A priority queue is served before anything else, so its packets wait the least. A weighted queue gets a share of what remains, in proportion to a weight. Voice goes in the priority queue because it needs low delay. Everything else shares by weight, so that no class is starved.
The priority queue is served first, up to its limit, and it holds voice. The weighted queues then share what remains in proportion to their weights, and they hold video, business data and default traffic.
| Style | How it is served | Good for | Risk |
|---|---|---|---|
| Priority (low latency) | Before every other queue, up to a limit | Voice and other small, delay-sensitive packets | Takes room from the others if it is overfilled |
| Weighted | A share of the remaining rate, in proportion to its weight | Video, business data and default traffic | A class that offers less than its share frees the rest for the others |
What each class receives, worked out
Take a circuit shaped at 95 Mbps. Voice is 75 calls at 108 kbps each, which is 8.1 Mbps, and it goes in the priority queue. The remaining 86.9 Mbps is shared by three weighted classes, with weights 25 for video, 35 for business data and 20 for default. When every class has more to send than its share, each one gets its weight divided by the total weight, 80, of the 86.9 Mbps. When a class offers less than its share, the unused part is shared among the classes that still want more.
The shaped rate is 95 megabits. Voice takes 8.1 from the priority queue, which leaves 86.9 to share. Video takes 18.0, which is less than its share and all it asked for. The remaining 68.9 is split between business data and default in the ratio 35 to 20.
- Shaped95 Mbps
- Voicetakes 8.1,priority
- Shared86.9 Mbps
- Videotakes 18.0,all it asks
- Split68.9 in theratio 35:20
| Class | Weight | Offered | Received |
|---|---|---|---|
| Video | 25 | 18 Mbps | 18.0 Mbps, all of it |
| Business data | 35 | 60 Mbps | 43.8 Mbps |
| Default (backups and the rest) | 20 | 80 Mbps | 25.1 Mbps |
| If business offers only 10 Mbps | 35 | 10 Mbps | 10.0 Mbps; default then receives 58.9 Mbps |
Two points follow. A weight is not a limit: a class can use more than its share when others are quiet. And it is not a guarantee of a fixed number either, because the share depends on which classes are busy. The guarantee is the minimum a class receives when everyone is busy.
What happens when a queue fills
A queue has a finite length. When it is full, something has to be dropped. The simplest rule drops whatever arrives next, which is tail drop. The alternative drops a few packets early and at random as the queue grows.
Tail drop discards the packets that arrive when the queue is full, so many flows slow down together. Random early detection discards a few packets early, so flows slow down one at a time.
| Policy | What it drops | Effect on TCP | Fits |
|---|---|---|---|
| Tail drop | Packets that arrive when the queue is full | Many flows lose packets together and slow down together, then speed up together | Voice and other traffic that does not slow down |
| Random early detection | A few packets, at random, as the queue builds | Flows slow down one at a time, which keeps the queue shorter | Queues that carry mostly TCP data |
Worked example: video marked as voice
Interactive video was breaking up and someone decided that video is important, so the video endpoints were re-marked EF to put them in the priority queue. Voice calls then began to break up as well. The priority class is limited to 20 Mbps while the link is congested. Voice offers 8.1 Mbps and video offers 18 Mbps, together 26.1 Mbps, which is more than the limit.
| Queue | Class | Offered | Limit | Sent | Dropped |
|---|---|---|---|---|---|
| Priority | Voice and video, both EF | 26.1 Mbps | 20.0 Mbps | 20.0 Mbps | 6.1 Mbps (23 percent) |
| Weighted | Business data | 60 Mbps | weight 35 | 47.7 Mbps | 12.3 Mbps |
| Weighted | Default | 80 Mbps | weight 20 | 27.3 Mbps | 52.7 Mbps |
Voice broke up after video was marked EF. The priority queue offered 26.1 megabits and may send 20, so it drops 23 percent of everything in it. The loss hits voice as well as video, because the queue does not tell them apart. The fix is to give video its own weighted class.
- SymptomVoice breaks up after video was re-markedlink and tunnel look healthy
- Offered8.1 Mbps voice plus 18 Mbps video26.1 Mbps in the priority class
- Limit20 Mbps while congested6.1 Mbps cannot be sent
- Loss6.1 of 26.1 Mbps, 23.4 percentvoice and video lose alike
- FixVideo back to AF41, in its ownweighted queue; priority keeps voice
The repair is to put video in a weighted queue of its own, with a weight that gives it enough in the busy hour, and to keep the priority queue for voice. With video out of the priority class, voice offers 8.1 Mbps against a 20 Mbps limit and loses nothing, and video receives its full 18 Mbps in the sharing table above. The lesson is about sizing: a priority class is a promise for a known amount of traffic, and more than that breaks the promise for all of it.
The repair has a cost that the counters make visible. The link is full either way, so the extra rate that voice and video receive has to come from the weighted classes that were using it. The table shows who pays.
| Class | Before | After | Change |
|---|---|---|---|
| Voice | 6.2 Mbps sent | 8.1 Mbps sent | +1.9 Mbps |
| Video | 13.8 Mbps sent | 18.0 Mbps sent | +4.2 Mbps |
| Business data | 47.7 Mbps | 43.8 Mbps | -3.9 Mbps |
| Default | 27.3 Mbps | 25.1 Mbps | -2.2 Mbps |
| Total | 95.0 Mbps | 95.0 Mbps | 0 |
Where classification happens
Classification and queueing happen at different edges. The sending edge classifies on its LAN side, from the marks the hosts set or from its own rules, and queues on its WAN side. The receiving edge classifies the arriving packets again, from the marks that crossed the provider, and queues them for its own LAN. Each edge therefore schedules the direction that leaves it, and an asymmetric circuit needs a shaper for each direction.
The sending edge classifies on its LAN side and queues and shapes on its WAN side. The provider carries the marks. The far edge classifies the arriving packets again on its WAN side and queues them for its own LAN.
- Send edgeLAN side:classify
- Send edgeWAN side:queue, shape
- Providercarriesthe marks
- Far edgeWAN side:classify
- Far edgeLAN side:queue
Learn more: QoS Architecture and DSCP MappingQoS Concepts: Marking, Queueing and Shaping
Test yourself
A link runs at 40 percent of its rate all day. A QoS policy is in place. What does the scheduler do?
A priority class is limited to 20 Mbps. Voice offers 8.1 Mbps and video offers 18 Mbps, both in that class. What share of the priority traffic is dropped?
Three weighted classes have weights 25, 35 and 20, and all are busy on 80 Mbps of spare rate. What does the 35 class receive?
A weighted class offers less than its share. What happens to its unused share?
Why is random early detection a poor choice for a voice queue?
In the worked example, video moves out of the priority queue into its own weighted class. What happens to the business-data class?
A circuit is shaped at 95 Mbps and voice takes 8.1 Mbps from the priority queue. Video has weight 25 out of a total of 80. What is video's share of what is left when every weighted class is busy?
A branch circuit sends at 20 Mbps and the hub circuit sends toward the branch at 100 Mbps (example rates). Where is each direction shaped?