Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 25

CNPA B

Nasser S. Abouzakhar

Queuing Disciplines
Week 8 Lecture 2
16th November, 2009

Content
Introduction
FIFO (first-in-first-out)
FQ (fair queuing)

Introduction
Each router must implement some queuing discipline
that governs how packets are buffered while waiting
to be transmitted.
The queuing algorithm can be thought of as:

allocating BW (which packets are transmitted), and


allocating buffer space (which packets get dropped).

It also affects the packets latency, by determining how


long a packet waits to be transmitted.
The two common queuing algorithms are

FIFO and FQ (Fair Queuing)


Source: Peterson & Davie, 2007 p 467

FIFO

Also known as FCFS (firstcome-first-served).


The first packet that arrives
at a router is the first packet
to be transmitted.
The router discards packets
that arrive whilst the queue
(buffer space) is full. This is
sometimes called tail drop.
(a) FIFO queuing

(b) tail drop at a FIFO queue.

Source: Peterson & Davie, 2007 p 468

FIFO, cont.

FIFO is a scheduling discipline.

Tail drop is a drop policy.

determines the order in which packet are transmitted.


determines which packets get dropped.

FIFO with tail drop is the simplest of all queuing algorithms


and the most widely used in Internet routers.

Source: Peterson & Davie, 2007 p 469

FIFO, cont.

Priority queuing is a simple variation on basic FIFO


queuing.

Marks each packet with a priority.


For example, the IP Type of Service (TOS) field.

The routers then implements multiple FIFO queues, one for


each priority class.
The router always transmits packets out of the highestpriority queue.
Limitations:

The high-priority queue can starve out all the other queues.
Source: Peterson & Davie, 2007 p 469

FIFO, cont.

The routers implement multiple FIFO queues, one


for each class.
Packets with highest-priority are transmitted first.
However, the high-priority queue can dominate the front
lines hence the lower-priority queues dont get served.
Therefore, there should be certain limits on how much
high-priority traffic is inserted in the queue.

Source: Peterson & Davie, 2007 p 469

Fair Queuing (FQ)

FIFO does not discriminate between different traffic


sources.
FIFO does not separate packets according to the flow to
which they belong.
FQ maintains a separate queue for each flow currently being
handled by the router.
These queues are served by the router in a round-robin
service.

Source: Peterson & Davie, 2007 p 470

FQ, cont.

When a flow sends packets too


quickly, then its queue fills up.
When a queue reaches a certain
length, any additional packets are
discarded.
Therefore, a given source cannot
increase its share of the networks
capacity at the expense of the other
queues.

Round-robin service of four flows at


a router.

Source: Peterson & Davie, 2007 p 470

FQ, cont.
The packets being processed at a router may not
have the same length.
To allocate the BW of outgoing link in a fair manner,
packets length is taken into account.
Example:

If one router is managing 2 flows, one with 1000-byte


packets and the other with 500-byte packets.
A round-robin servicing packets from each flows queue
will give the 1st flow 2/3 of the links BW and the 2nd
flow only 1/3 of its BW.
Source: Peterson & Davie, 2007 p 471

10

FQ, cont.

FQ determines when a given packet would finish being


transmitted.
The finishing time is used to sequence the packets for
transmission.
Let Pi denote the length of packet i in bits.
Let Si denote the time when the router starts to transmit
packet i.
Pi is expressed in terms of clock ticks to transmit packet i.
Let Fi denote the time when the router finishes transmitting
packet i.
F S P
i

Source: Peterson & Davie, 2007 p 471

11

FQ, cont.
Routers often have more than one active flow i.e. has
data in the queue.
We calculate Fi for each packet that arrives using the
above formula.

Fi Si Pi

We treat all the Fi as timestamps, and the packet that


has the lowest timestamp will be transmitted first.
Source: Peterson & Davie, 2007 p 472

12

FQ, cont.

It is possible that the router finished transmitting packet i


1 long before i arrived.
This means that the round-robin mechanism could not send
any packets from this flow during which the queue was
empty.

If so, then let Ai denote the time that packet i arrives at the
router, thus

Si max Fi 1 , Ai Fi max Fi 1 , Ai Pi
Source: Peterson & Davie, 2007 p 472

13

FQ, cont.

If there is more than one flow, we calculate Fi as timestamps


for each flow.
The packet with the lowest timestamp is transmitted first.

(a) Packets with earlier finishing times are sent first.


(b) Sending of a packet already in progress is completed.

Source: Peterson & Davie, 2007 p 472

14

Weighted Fair Queuing (WFQ)

allows a weight to be assigned to each flow (queue).


specifies how many bits to send (BW) each time the router
services that queue.
Example:
a router has 3 flows (queues), one queue has a weight of 2,
the second queue has a weight of 3, and the third queue has
a weight of 1. Assuming that each flow always contains a
packet waiting to be sent, what is the percentage of BW that
is assigned to each flow?
Source: Peterson & Davie, 2007 p 473

15

WFQ, cont.

Solution
The first flow will get 1/3 of the available BW.
The second flow will get of the available BW.
The third flow will get 1/6 of the available BW.

Source: Peterson & Davie, 2007 p 473

16

Example
Suppose a router has 3 input flows and one output. It
receives the packets listed in Table 1 all at about the same
time, in the order listed, during a period in which the output
port is busy but all queues are otherwise empty. Give the
order in which the packets are transmitted, assuming:
(a) Fair queuing.
(b) Weighted fair queuing with flow 1 having a weight of 2,
flow 2 having twice as much share as flow 1, and flow 3
having 1.5 times as much share as flow 1. Note that ties are
to be resolved in order flow 1, flow 2, flow 3.

Source: Peterson & Davie, 2007 p 529

17

Example, cont.
Packet

Size

Flow

200

200

160

120

160

210

150

90

Table 1

Source: Peterson & Davie, 2007 p 530

18

Solution
(a) Fi is the cumulative per-flow size.

Fi max Fi 1 , Ai Pi
Consider Ai = 0 as all packets are
received at about the same time so
there is no waiting.

Fi Fi 1 Pi

Packet

Size

Flow

Fi

200

200

200

400

160

160

120

160

210

150

90

Source: Peterson & Davie, 2007 p 737

19

Solution, cont.
Packet

Size

Flow

Fi

200

200

200

400

160

160

120

280

160

440

210

210

150

360

90

450

20

Solution, cont.

So, packets are sent in


increasing order of Fi:
Packet 3, Packet 1,
Packet 6, Packet 4,
Packet 7, Packet 2,
Packet 5, Packet 8.

Packet

Size

Flow

Fi

200

200

200

400

160

160

120

280

160

440

210

210

150

360

90

450

21

Solution, cont.
(b) Flow 1 has a weight of 2, so

Fi Fi 1 Pi / 2
Flow 2 has a weight of 4, so

Fi Fi 1 Pi / 4
Flow 3 has a weight of 3, so

Packet

Size

Flow

Weighted Fi

200

100

200

200

160

40

120

160

210

150

90

Fi Fi 1 Pi / 3

Source: Peterson & Davie, 2007 p 737

22

Solution, cont.
Packet

Size

Flow

Weighted Fi

200

100

200

200

160

40

120

70

160

110

210

70

150

120

90

150

23

Solution, cont.

So, packets are sent in


increasing order of
weighted Fi:
Packet 3, Packet 4,
Packet 6, Packet 1,
Packet 5, Packet 7,
Packet 8, Packet 2.

Packet

Size

Flow

Weighted Fi

200

100

200

200

160

40

120

70

160

110

210

70

150

120

90

150

24

Reference

Computer Networks: A systems approach by Larry


Peterson and Bruce Davie, published by Morgan
Kaufmann (Fourth edition ISBN: 0 12 370548 7).

25

You might also like