1 of 65

CMPT 471/771: Computer Networks��Router Design and QoS Support

Instructor: Mohamed Hefeeda

1

School of Computing Science �Simon Fraser University

2 of 65

Outline

  • Router architecture
    • Packet path: input port, fabric, output port
  • Address lookup
    • Longest prefix match in TCAM and SRAM
  • Fabric, queues and loss
    • HOL blocking, buffer size, what to drop (RED)
  • Scheduling
    • Priority, WFQ, DRR
  • Quality of service (QoS)
    • Token bucket, delay bounds, IntServ, DiffServ

2

3 of 65

Router Architecture Overview

3

CPU: Routing Processor

Switching Fabric

1

2

N

.

.

.

Input Ports

1

2

N

.

.

.

Output Ports

Control Plane

Data Plane

Insert forwarding rules

4 of 65

Packet Path Through a Router

  • Input port: lookup, classify, police: one pipeline, every packet
  • Fabric: moves each packet to its output port
  • Output port: queue and schedule each class, then send
  • Drops at both: policer (input); full queue or early drop (output)
  • Deck follows this path; P4 programs it (next module)

4

Input port

Switching fabric

Output port

Lookup

output port

Classify

class

Police

rate check

ingress match-action pipeline

Queue

buffer, early drops

Schedule

which packet next

Send

to link

traffic manager (buffer, queues, scheduler)

5 of 65

Input Port Functions

  • Receive: bits → frame (physical and link layers)
  • Lookup: destination address → output port (next slides)
  • Classify and police: class and rate check (QoS part)
  • Goal: line speed: 6.7 ns per 64 B packet at 100 Gb/s
  • Queuing: if packets arrive faster than fabric takes them

5

Line termination

bits in

Link layer (receive)

frame (e.g., Ethernet)

Lookup

output port (longest prefix match)

Classify

class (DSCP, headers)

Police

rate check: pass, mark, drop

one match-action pipeline, at line speed

Input queue

waits if fabric busy

fabric

6 of 65

Destination-based Forwarding

6

  • Look-up is done at input port
  • IP routers forward packets by:
    • examining destination address, and
    • matching it with local forwarding table

src: 200.33.22.111

dst: 142.58.228.150

data

​

​

​

Forwarding Table

IP Packet

Match

Uses longest prefix matching algorithm 🡺 costly operation

142.0.0.0/8

142.58.0.0/16

……

​

7 of 65

Longest Prefix and TCAM

  • Longest prefix matching: often performed using Ternary Content Addressable Memory (TCAM) in high-speed routers

​

  • TCAM Advantages:
    • Fast: Read operation is done in one clock cycle
    • Can support wildcard (i.e., ignore some values or ‘do not care’ about them)
      • e.g., 1*01 would match both 1101 and 1001 in TCAM

​

  • TCAM Disadvantages:
    • Larger chip area
    • Higher power consumption
    • Expensive

​

7

8 of 65

CAM: Brief Intro

  • We access regular memory (e.g., DRAM) using address
  • In contrast, we access CAM using key (content)
    • Input key is compared against all entries in CAM at the same time
    • CAM matches zeros and ones of key against its entries
    • And returns addresses of entries that match given key

8

CAM

1

0

1

0

1

1

0

0

1

1

1

1

Entry 2

Entry 3

Entry 4

Search for

1

0

1

0

Entry 1

1

1

1

0

0

0

1

0

9 of 65

TCAM: Brief Intro

  • Ternary CAM (TCAM)
    • Can also match third state, aka “do not care”. (Hence name Ternary)
    • Do not care states are usually referred to as X in TCAM entries
    • However, actual implementation does not store X in entries
    • Rather, it associates ‘mask’ with each entry:
    • E.g., mask: 1111 1111 1111 0000 🡺 means we do not care about 4 right-most bits in corresponding TCAM entry, they can be anything (0 or 1)

9

10 of 65

TCAM: Example

  • Input key 1010 matches Entries 3 and 4; Entry 3 has higher priority
    • 🡺 address of entry 3 is outputted by TCAM, which is then used as index to find specific port number

10

TCAM

1

0

X

X

1

1

0

X

X

X

X

X

Entry 2

Entry 3

Entry 4

Search for

1

0

1

0

Entry 1

1

1

X

X

0

0

1

1

Highest Priority

11 of 65

TCAM Limitations

  • Fixed at design time
    • Chip fixes key fields and actions
    • New header or protocol needs new chip: months to years
  • Limited size
    • Forwarding table must fit, and it keeps growing (next slide)
  • Costly in area and power
    • Every lookup compares key with every entry at once
  • Slow to update
    • Entries are kept longest first, so one new prefix can shift many
  • Answers: network processors (flexible, slower) and P4 (next module)

11

12 of 65

TCAM Limits in Practice: 512k Day (2014)

  • Event: August 12, 2014
    • Global IPv4 table passed 512,000 routes
    • Many Cisco routers had room for only 512k
    • Extra routes went to slow CPU path
    • About 140 networks went down
  • Fix: give IPv4 more of TCAM, then reboot
    • Space comes from IPv6 and other tables
  • Lesson: tables outgrow routers
    • Today: 1.05M IPv4, 242k IPv6 routes

12

512k

768k

1.05M

512k limit

2012

2026

IPv4 routes in global table

13 of 65

Longest Prefix Match in SRAM: Tries

  • TCAM: fast but costly in area and power, so chips keep it small
  • Most routes sit in SRAM, searched by algorithm, e.g., trie
  • Trie walk: one memory read per address bit: up to 32 (IPv4)
  • Multibit trie: k bits per step → 32 / k reads (k = 8: 4 reads)
    • Fewer reads, but bigger nodes (2k children)

13

Prefixes:

0* → port A

10* → port B

101* → port C

11* → port D

Lookup: 1011…

0

1

0

1

1

0*

A

10*

B

11*

D

101*

C

bit 1: go right

bit 0: 10* matches, remember B

bit 1: 101* matches, remember C

bit 1: no child: answer C (101*)

14 of 65

Switching Fabric

  • Transfer packet from input buffer to appropriate output buffer
  • Switching rate: rate at which packets can be transferred from inputs to outputs
  • Three main types of switching fabrics
    • from software (low-end) routers to high-speed routers

​

14

memory

memory

bus

crossbar

15 of 65

Input Port Queuing

  • Fabric slower than input ports combined 🡪 queuing may occur at input queues
    • queuing delay and loss due to input buffer overflow!
  • Head-of-the-Line (HOL) blocking: queued packet at front of queue prevents others from moving forward

​

15

Switching fabric

only one red packet can be transferred at the same time 🡺 lower red packet is blocked 🡺 Green packet must wait (unnecessarily)

blocked

16 of 65

HOL Solution: Virtual Output Queue

  • Create virtual queue for each output port (in input buffer)
    • Packets are switched separately for each virtual queue
  • Used in high-speed routers

​

16

Switching fabric

Blocked (ok)

17 of 65

Output Ports

  • Buffering: packets arrive from fabric faster than link sends
    • Packets lost due to congestion and lack of buffers
  • Queue management: what to drop, and when (AQM)
  • Scheduler chooses among queued packets for transmission

17

fabric

class 1

class 2

class 3

per-class queues (buffer)

Scheduler

SP + DWRR

class 1 first;

others by weight

Link layer (send)

frame (e.g., Ethernet)

Line termination

bits out

link

AQM: drop early

18 of 65

Buffer Sizing

  • Packets arrive in bursts; link sends at fixed rate C
    • Buffer absorbs burst and drains it later
  • Too-small buffer overflows
    • Packets drop; TCP slows down; link sits idle
  • Too-large buffer stays full
    • Every packet waits up to B / C before it is sent
    • Fast on-chip memory is small and expensive
  • Goal: smallest buffer B to keep link busy

18

C

buffer of B bits

drain time B / C

C: link rate (bits/s)

B: buffer size (bits)

19 of 65

Buffer Sizing: One TCP Flow

  • TCP carries most of the traffic
    • Probes until loss: TCP fills buffers
    • Light traffic (e.g., voice) does not
  • Busy link needs RTT × C bits in flight
    • In flight = rate × time (Little's Law)
  • Window grows until buffer overflows
    • Largest window = RTT × C + B
  • Loss halves window; link stays busy if (RTT × C + B) / 2 ≥ RTT × C

B ≥ RTT × C

  • Backbone port: 10 Gb/s × 250 ms = 2.5 Gbit (312 MB)
    • Needs large, slow off-chip memory. Many flows: need less? (next)

19

buffer full: RTT × C + B

link full: RTT × C

up to B

queued

window

time

20 of 65

Buffer Sizing: Many TCP Flows

  • Losses hit flows at random times: sum smooths out
  • Each flow swings by about RTT × C / n
    • n random swings partly cancel: sum ≈ √n̅ × one swing

20

1 flow: swing = RTT × C

10 flows: swing ≈ ⅓ of it

100 flows: swing ≈ 1/10 of it

total window over time (mean = 1)

21 of 65

Buffer Sizing: Examples

  • Datacenter: enough for steady flows; incast still overflows
  • Wrong size hurts: too small → loss; too large → delay
    • Netflix: both raised video rebuffering, up to 50%

21

​

Internet backbone link

Datacenter switch port

Link rate C

10 Gb/s

100 Gb/s

RTT

250 ms

20 µs

Flows n

50,000

100

One flow: RTT × C

2.5 Gbit (312 MB)

2 Mbit (250 KB)

Many flows: RTT × C / √n̅

≈ 11 Mbit (1.4 MB)

200 kbit (25 KB)

Real buffers

deep routers: GBs (off-chip)

chip: ≈ 500 KB per port

22 of 65

Packet Losses and their Impact

  • Most loss happens in router buffers
    • Full queue drops arriving packets
    • Also: bit errors (wireless), failures, bad configs
  • Loss compounds over packets and hops

P(k packets all arrive) = (1 − p)k

    • p = 1%, k = 100: all arrive only 37% of the time
  • Each loss costs time
    • TCP resends (≥ 1 RTT later) and halves its window
    • Live voice and video skip packet instead
  • Routers decide what to drop (next slides)

22

Full output queue

link

dropped

p = 1% per packet:

(0.99)100 ≈ 0.37

23 of 65

Active Queue Management (AQM)

  • Queue stage answers two questions
    • How big? Buffer sizing (previous slides)
    • What to drop, and when? Queue management
  • Tail drop: drop only when buffer is full
    • Queue stays full (delay); many flows lose at once
  • AQM: drop or mark a few packets early
    • Senders slow down before buffer fills
    • Key example: Random Early Detection (RED)

23

input port

output port

Lookup

Classify

Police

Queue

how big? what to drop?

Schedule

which packet next? (later)

Send

fabric

24 of 65

Random Early Detection (RED)

  • Router implementing RED:
    • Monitors its packet queue and
    • Randomly drops packets as function of queue length before congestion happens
    • Probability of dropping increases as queue grows

​

  • TCP sender sees loss (3 dup ACKs or timeout) and slows down

​

  • 🡺 queue length at router decreases 🡺 congestion avoided

​

​

24

25 of 65

Random Early Detection (RED)

  • RED defines two thresholds for queue at router:

25

link

arrivals

departures

AvgLen

MinThresh

MaxThresh

P(drop)

AvgLen

1.0

MaxP

AvgLen < MinThresh:

no drops

between thresholds:

drop with P rising to MaxP

AvgLen > MaxThresh:

drop every arrival

Probability of dropping grows with average queue length

26 of 65

RED: Drop Probability

  • RED tracks average queue length, not current one
    • AvgLen ← (1 − w) × AvgLen + w × QueueLen, with small w (e.g., 0.002)
    • Short burst passes; queue that stays long gets drops
  • Between two thresholds, drop probability rises linearly

p = MaxP × (AvgLen − MinThresh) / (MaxThresh − MinThresh)

    • Example: MinThresh = 5, MaxThresh = 15 packets, MaxP = 0.1
    • AvgLen = 10 packets gives p = 0.1 × 5 / 10 = 0.05
  • Random drops hit each flow in proportion to its rate
    • A few flows slow down, not all of them at once
    • With ECN, RED marks packets instead of dropping them

26

27 of 65

Random Early Detection (RED)

  • RED is not widely deployed
    • It is hard to tune: good thresholds depend on traffic
    • Successors control delay, not queue length; little tuning
  • More AQM methods in later module, including:
    • CoDel, PIE, fq_codel (congestion control module)

​

​

  • For more info:
    • IETF Recommendations Regarding Active Queue Management [RFC 7567]

​

​

27

28 of 65

Packet Path: From Queuing to Scheduling

  • Done: queue stage: buffer size, what to drop (RED)
  • Now: schedule stage: which queued packet goes next
  • Later: classify and police (QoS part)

28

Input port

Switching fabric

Output port

Lookup

output port

Classify

class

Police

rate check

ingress match-action pipeline

Queue

buffer, RED (done)

Schedule

which packet next (now)

Send

to link

traffic manager (buffer, queues, scheduler)

29 of 65

Scheduling Policy

  • Scheduling: choose next packet to send on link

​

  • FIFO (first in first out) scheduling: send in order of arrival to queue
    • discard policy: if packet arrives to full queue: which one to discard?
      • tail drop: drop arriving packet
      • priority: drop/remove on priority basis
      • random: drop/remove randomly

​

29

link

(server)

queue

(waiting area)

packet

arrivals

packet

departures

Switching fabric

Output queue

30 of 65

Scheduling Policy: Priority

  • Priority scheduling: send highest priority queued packet
    • multiple classes, with different priorities
    • Packet classification may depend on pkt headers, e.g., IP src/dst, port numbers
    • Or packet “marking”

​

​

​

30

high priority queue

(waiting area)

low priority queue

(waiting area)

arrivals

classify

departures

link

(server)

Switching fabric

Output queue

31 of 65

Scheduling Policy: Other Policies

  • Round Robin (RR):
    • multiple classes
    • cyclically scan class queues, sending one complete packet from each class (if available)
  • Weighted Fair Queuing (WFQ):
    • generalized Round Robin
    • each class gets weighted amount of service in each cycle

​

  • Deficit Round Robin (DRR):
    • byte-fair round robin (next slides)

31

Output queue

Switching fabric

32 of 65

Round Robin: Packets vs. Bytes

  • Round robin: one packet per queue per round
    • A sends 1,500 B packets, B sends 64 B
    • A gets 1,500 / 64 ≈ 23× bandwidth of B
  • Fair share must count bytes, not packets
    • WFQ: ideal order, O(log n) work (next)
    • DRR: near-ideal, O(1) work

32

One round of round robin

A

1,500 B

B

64 B

Same number of packets,

very different bytes

33 of 65

Packet Scheduling Policy: WFQ

  • Ideal: bit-by-bit round robin
    • Each busy queue i sends wi bits per turn
  • WFQ: whole packets, in ideal's order
    • F: time its last bit would leave, bit by bit
    • Send packet with smallest F
  • Example: equal weights, same arrival
    • A: 1,000 B, B: 500 B → B finishes first, sent first
  • Next: how scheduler finds smallest F

33

34 of 65

WFQ: Picking the Next Packet

  • Each queue is FIFO: F only grows along it, so only heads compete
  • One min-heap holds n heads: send root, insert next head: O(log n)
  • F computed on arrival: F = max(Fprev, V) + size / wi
    • V (virtual time): progress of bit-by-bit ideal; tracking it costs work
    • DRR avoids F and V altogether: O(1)

34

FIFO queues (F of each packet)

A

21

16

12

B

14

10

5

C

18

13

9

min-heap of heads

B: 5

C: 9

A: 12

send B (F = 5)

after: insert B's next (F = 10)

C: 9

B: 10

A: 12

35 of 65

WFQ: Guaranteed Rates

  • Class i has weight wi; link rate is R

Ri = R × wi / Σj wj

    • Class i gets at least Ri while it has packets
  • Why: per turn, class i gets wi of Σj wj bits
  • Example: weights 3, 2, 1; R = 12 Mb/s
    • All busy: 6, 4 and 2 Mb/s
    • Class 3 idle: 7.2 and 4.8 Mb/s
  • Work-conserving: idle shares are reused
  • Use: guaranteed rate for voice or customer

35

12 Mb/s link, weights 3 : 2 : 1

All busy

6

4

2

Class 3 idle

7.2

4.8

Class 1 red, class 2 green, class 3 blue

(Mb/s inside each bar)

36 of 65

Deficit Round Robin (DRR)

  • Each queue: credit counter (bytes)
  • Each round, per busy queue:
    • Add quantum Q to its credit
    • Send head packets while credit lasts
    • Keep leftover for next round
  • Emptied queue: credit back to 0
  • Fair in bytes over a few rounds
  • O(1) work

36

Example: Q = 500 B per round

credit after

round 1 / 2

A

200

750

300 / 0

B

500

500

0 / 0

C

1,000

500 / 0

head

sent in round 1

in round 2

Each queue sends 950–1,000 B

in two rounds: fair in bytes

37 of 65

Weighted DRR (DWRR)

  • Queue i gets own quantum Qi ∝ wi
    • Each round, queue i sends about Qi bytes

Ri ≈ R × Qi / Σj Qj

  • Why: each round sends Σj Qj bytes
  • Example: weights 3 : 2 : 1
    • Qi = 1,500 B × wi: 4,500, 3,000, 1,500 B
    • Shares ½, ⅓, ⅙: on 12 Mb/s, 6, 4, 2 Mb/s
  • Same shares as WFQ, at O(1) work
  • Use: switch chips (WDRR)

37

One DWRR round: 9,000 B

4,500 B

3,000

1,500

On 12 Mb/s link

6 Mb/s

4

2

queue 1 red, 2 green, 3 blue:

same 3 : 2 : 1 shares as WFQ

38 of 65

Scheduler Comparison

38

Scheduler

Sends next

Good at

Weak at

Work per packet

FIFO

oldest packet

simple

no isolation: one burst delays all

O(1)

Strict priority

from highest busy class

lowest delay for top class

starves others unless top class is policed

O(1)

Round robin

one packet per busy queue, in turn

isolates queues

fair in packets, not bytes

O(1)

WFQ

packet that would finish first bit by bit

byte-fair, weighted; guaranteed rates

must sort finish times

O(log n)

DRR, DWRR

head packets while credit lasts

byte-fair over a few rounds; weighted (DWRR)

bursts of up to one quantum

O(1)

Switch chips combine them: strict priority for a few classes, DWRR for the rest

39 of 65

Think About It: Choosing the DRR Quantum

  • Queue A: 1,500 B packets; Q = 500 B

Think: how often does A send? Best Q?

​

  • A sends only every 3rd round
    • 2 of 3 visits send nothing: wasted work
  • Choose Q ≥ largest packet (1,500 B)
    • Each visit to busy queue sends ≥ 1 packet
    • Keeps DRR at O(1) work
    • Weights: Qi = 1,500 B × wi

39

A's credit each round (Q = 500 B)

packet

1,500 B

1

2

3

send

4

5

6

send

round

40 of 65

QoS Motivation: Voice Meets File Transfer

  • File transfer (TCP) fills router queue: 100 packets of 1,500 B
  • Voice packet waits behind them: 1.2 Mbit / 1.5 Mb/s = 0.8 s
  • Voice needs about 100 ms or less: call breaks up
  • FIFO cannot tell voice from file transfer

40

voice

1 Mb/s

file transfer

router queue (FIFO, 100 packets)

1.5 Mb/s link

Internet

voice packet waits 0.8 s

41 of 65

QoS Motivation: More Examples

41

Datacenter: storage meets bulk copy

RDMA storage traffic needs no loss

Bulk copy fills switch buffer:

RDMA packets dropped, slow recovery

QoS: own lossless class (PFC), own queue

Same pattern: one link, traffic with different needs

5G cell: voice, video, web on one radio

Voice: guaranteed rate, 100 ms budget

Web, e-mail: best effort, 300 ms

Network marks each flow's class

QoS: scheduler serves classes by need

42 of 65

QoS Needs: Classify, Police, Share, Admit

  • 1 Mb/s voice call and file transfer share 1.5 Mb/s link
  • File-transfer bursts fill queue; voice waits
    • Classify: mark packets so routers can tell them apart
  • Voice sends more than it declared
    • Police: hold each class to its agreed rate
  • Voice is silent for a while
    • Share: let file transfer use idle capacity
  • Second 1 Mb/s call asks to join
    • Admit: 2 Mb/s does not fit in 1.5 Mb/s; refuse it

42

voice

1 Mb/s

file

transfer

router

1.5 Mb/s

Four needs: classify, police,

share, admit

43 of 65

QoS and Router Mechanisms

  • So far, at output port: queue and schedule
    • Each class gets its own queue and share
  • QoS adds, at input port and network edge:
    • Classify: mark each packet's class
    • Police: hold flows to agreed rate and burst
    • Admit: refuse flows that do not fit
  • Result: rate and delay guarantees, end to end

43

input port

output port

Lookup

Classify

DSCP marks (DiffServ)

Police

token bucket (next)

Queue

buffer, AQM (done)

Schedule

SP, WFQ, DRR (done)

Send

fabric

44 of 65

QoS in IP Networks: Two Models

  • Differentiated QoS (DiffServ)
    • Works on traffic classes (connections with similar properties are put in same class)
    • Provides relative performance among classes

​

  • Integrated QoS (IntServ)
    • Needs to reserve resources
    • Provides guarantees to individual traffic flows (connections)

​

  • In both models, routers need to perform additional functions (beyond basic packet forwarding)
    • Functions: classify, police, share, admit (example before)

​

44

45 of 65

Policing Mechanisms

Goal: limit traffic so that it does not exceed declared parameters

Three commonly-used criteria:

  • Average Rate: how many pkts can be sent per unit time (in long run)
    • Crucial question: what is interval length: 100 packets per sec and 6000 packets per min (ppm) have same average!
  • Peak Rate: maximum allowed rate over shorter period of time
    • Avg rate: 600 ppm
    • Peak rate: 1500 ppm
  • Burst Size: maximum #pkts sent consecutively (with no intervening idle time)

​

45

46 of 65

Policing Mechanisms: Token Bucket (aka Leaky Bucket)

Token Bucket: controls Burst Size and Average Rate

(aka Leaky Bucket)

  • Bucket can hold up to b tokens
  • Tokens generated at rate r token/sec unless bucket full
  • Router consumes one token to forward pkt 🡺
    • burst size is limited to b
    • over interval of length t: #pkts forwarded <= (r*t + b)

46

Token bucket limits max burst size. How can we control delay?

Exercise: extend token bucket to also control peak rate.

Hint: use two buckets and adjust their parameters.

47 of 65

Token Bucket: Policing vs. Shaping

  • Passes ≤ b + r·t bits in any time t
    • b: largest burst; r: long-run rate
  • Example: r = 10 Mb/s, b = 1 Mbit
    • Bucket full; 1.5 Mbit burst arrives
    • About 0.5 Mbit of it is excess
  • Policer: drop or mark excess
    • No delay; used at network entry
  • Shaper: hold excess for tokens
    • 0.5 Mbit / 10 Mb/s = 50 ms more delay

47

Shaper: packets wait in queue for tokens

Policer: no queue; packet without token

is dropped or marked

48 of 65

Token Bucket + WFQ

  • Token bucket + WFQ 🡺 provide guaranteed upper bound on delay, i.e., QoS guarantee! How?
    • WFQ: guarantees share of bandwidth
    • Token bucket: limits max number of packets in queue (burst b)

48

49 of 65

Token Bucket + WFQ

  • Token bucket + WFQ 🡺 provide guaranteed upper bound on delay, i.e., QoS guarantee! How?
    • WFQ: guarantees share of bandwidth
    • Token bucket: limits max number of packets in queue (burst b)

49

50 of 65

Example: Delay Guarantee (Token Bucket + WFQ)

dmax ≤ b/Ri + K × L/Ri

    • b: bucket; Ri: WFQ rate; K: hops; L: max packet
  • Why: burst drains once; each hop adds one packet time
  • Example: b = 1 Mbit, Ri = 20 Mb/s, L = 1,500 B
    • One hop: 50 + 0.6 = 50.6 ms
    • Five hops: 50 + 5 × 0.6 = 53 ms
  • Use: lower delay needs smaller bursts or more rate

50

b / Ri

arrivals:

at most b + r·t

service:

Ri·t

b

time

51 of 65

Think About It: What Rate for 20 ms?

  • Flow from example: b = 1 Mbit, L = 1,500 B, K = 5 hops

Think: what rate must WFQ reserve for 20 ms delay bound?

​

  • From bound: Ri ≥ (b + K × L) / dmax
    • Ri ≥ (1 Mbit + 5 × 12,000 bits) / 20 ms = 53 Mb/s
  • Flow averages r = 10 Mb/s, yet needs 53 Mb/s reserved
    • Tight delay bound costs reserved rate
    • Smaller bursts cost less: b = 0.2 Mbit needs only 13 Mb/s

51

52 of 65

Scheduling in Practice: Strict Priority + DWRR

  • WFQ sorts: too slow at ns per packet
  • Switch port: 8–12 queues
    • Top queue (voice, control): strict priority
    • Policed, so it cannot starve the rest
    • Other queues: DWRR, weights = shares
  • Linux: fq_codel uses DRR
  • WFQ remains model for guarantees
    • DWRR also guarantees rate Ri (next)

52

voice

police

video w = 3

data w = 2

bulk w = 1

strict

priority,

then

DWRR

link

Voice goes first (policed);

others share by weight

53 of 65

Delay Bound with DWRR

  • Token bucket (r, b) + guaranteed rate Ri ≥ r
    • Bounds delay with any scheduler that guarantees Ri

dmax ≤ b/Ri + K × (extra wait per hop)

  • Why: burst drains at Ri; each hop may first serve others
    • WFQ: about one packet time, L/Ri
    • DWRR: up to a few rounds; one round = Σj Qj / R
  • Example: 8 queues × 1,500 B on 1 Gb/s: round ≈ 0.1 ms
    • 3 rounds × 5 hops ≈ 1.4 ms, small next to b/Ri = 50 ms
  • Use: DWRR gives nearly WFQ's bound at O(1) work

53

54 of 65

Integrated Services (IntServ)

  • Architecture for providing QoS guarantees in IP networks for individual sessions

​

  • For this to happen, resource reservation is needed

​

  • For reservation to be enforced, routers need to maintain state
    • State about allocated resources and QoS requirements of sessions
    • “Maintaining state” typically raises scalability concerns

​

  • We also need protocols to setup new sessions and deny them if their requirements cannot be met

​

54

55 of 65

IntServ: Session Admission

Arriving session must:

  • Declare its QoS requirement (e.g., bandwidth)
  • Characterize traffic it will send into network (e.g., avg. bitrate and max burst size)

​

​

Signaling protocol:

  • Is needed to carry requirements to routers (where reservation is required)

​

​

55

56 of 65

IntServ: Resource Reservation Protocol (RSVP)

  • Resource reservation
    • Session setup, signaling (RSVP)
    • traffic, QoS declaration
    • per-element admission control

56

    • QoS-sensitive scheduling (e.g., WFQ)

request/

reply

57 of 65

Concerns with IntServ

  • Scalability: maintaining per-flow state is difficult for large number of flows
    • Example: 2.5 Gbps link serving 64 Kbps audio streams 🡪 39,000 flows!
    • state maintenance 🡺 frequent updates 🡺 high load on routers 🡺 may cause packets to be delayed or dropped, defeating purpose in the first place

​

  • Inflexible Service Models: IntServ defines only two services
    • Guaranteed (hard delay bound) or Controlled Load (like lightly loaded network)

​

57

58 of 65

Differentiated Services (DiffServ)

  • DiffServ: offers differential quality among traffic classes

​

  • Edge router:
    • per-flow traffic management
    • Classifies (marks) pkts
      • different classes
      • within class: in-profile and out-profile
  • Core router:
    • per class traffic management
    • buffering and scheduling based on marking �at edge
    • preference given to in-profile packets

​

58

Marking

Scheduling

59 of 65

Edge Router: Logical Architecture

  • Traffic marked, metered, and shaped if non-conforming
    • Based on predefined traffic profiles (e.g., rate, burst size)

​

59

Classifier

Marker

Shaper/

Dropper

Meter

forward

drop

Packet is marked in Type of Service (TOS) field in IPv4, and Traffic Class field in IPv6

6 bits used for Differentiated Service Code Point (DSCP) and determine Per-Hop Behavior (PHB) that packet will receive

60 of 65

Core Router: Forwarding

  • PHB (Per Hop Behavior): results in different observable forwarding performance
  • PHB does not specify what mechanisms to use to ensure required PHB performance
  • Examples:
    • Class A gets x% of outgoing link bandwidth over time intervals of specified length
    • Class A packets leave first before packets from class B

​

  • Concerns with DiffServ
    • Relative quality is usually not good enough
    • PHB does not offer specific solutions

60

61 of 65

IntServ vs. DiffServ

61

​

IntServ

DiffServ

Unit of service

each flow

class of traffic

State in core routers

per flow

per class only (few queues)

Setup

RSVP reserves along path

none: edge marks DSCP

Promise

hard delay bound per flow

relative: better than other classes

Scales to backbones

no: 39,000 flows on one 2.5 Gb/s link

yes

Used today

few long-term reservations in ISPs; per-flow ideas in 5G, DetNet

inside enterprise, datacenter and access networks

62 of 65

DiffServ and IntServ in Practice

  • DiffServ and IntServ are NOT widely deployed on public Internet, because
    • They add complexity to network, and, more importantly, � “the observed performance difference is not significant”
      • i.e., “best effort” Internet yields similar performance most of the time!

​

  • Some home/enterprise routers use DiffServ
    • To differentiate multimedia traffic from others (within homes)
      • Note: last-mile hop (access link to Internet) is usually bottleneck

​

  • Some concepts from IntServ are used in ISPs
    • But to reserve bandwidth for major customers/organizations
      • Few reservations and less dynamic (reservations done for long periods, e.g., months)

62

63 of 65

QoS in Practice Today

  • Inside one network: DiffServ, few classes
    • Edge marks DSCP; e.g., voice = EF
    • Each port: 8–12 queues, priority + DWRR
  • Access links: AQM against bufferbloat
    • DOCSIS 3.1 cable modems must run PIE
    • Wi-Fi: voice, video, best effort, background
  • Per-flow guarantees where needed
    • 5G: guaranteed-rate flows, e.g., voice
    • Factories, cars: TSN, DetNet
  • Between networks (public Internet): best effort

63

64 of 65

Summary

  • Router: input ports, switching fabric, output ports
  • Input port: lookup (longest prefix match), classify, police
  • Output port: queue (buffer, AQM) and schedule each class
  • Buffers: RTT × C for one flow, RTT × C / √n̅ for n flows
  • AQM: RED, CoDel, PIE drop or mark early: short queues
  • Scheduling: WFQ is ideal; chips use priority + DWRR
  • QoS: token bucket + guaranteed rate bounds delay; DiffServ scales

64

65 of 65

Readings

65