cs144, stanford university error in q3-7. cs144, stanford university using longest prefix matching,...
TRANSCRIPT
CS144, Stanford University
Error in Q3-7
CS144, Stanford University 2
Using longest prefix matching, the IP address 21.44.9.5 will match which entry?
a. 21.0.0.0/8 b. 21.44.9.0/24c. 21.44.9.1/32 d. 21.44.9.2/28 IP address: …….. 0000 0101 .
Prefix: …….. 0000 0010/28
✔
IP address: …….. 0000 0101 . Prefix: …….. 0000 XXXX/28
CS144, Stanford University
CS144An Introduction to Computer Networks
Packet Switching
CS144, Stanford University 4
Outline
1. End-to-end delay2. Queueing delay3. Simpler queue model4. Rate guarantees5. Delay guarantees (hard!)
CS144, Stanford University 5
Propagation Delay, tl: The time it takes a single bit to travel over a link at propagation speed c.
l
Example: A bit takes 5ms to travel 1,000km in an optical fiber with propagation speed 2 x 108 m/s.
CS144, Stanford University 6
Packetization Delay, tp: The time from when the first to the last bit of a packet is transmitted.
p
Example 1: A 64byte packet takes 5.12ms to be transmitted onto a 100Mb/s link.Example 2: A 1kbit packet takes 1.024s to be transmitted onto a 1kb/s link.
r bits/s
CS144, Stanford University 7
End-to-end delayl1, r1 l2, r2
l3, r3l4, r4
Example: How long will it take a packet of length p to travel from A to B, from when the 1st bit is sent, until the last bit arrives? Assume the switches store-and-forward packets along the path.
A
B
CS144, Stanford University 8
l1, r1 l2, r2 l3, r3 l4, r4A B
S1 S2 S3
A
B
S1
S2
S3
p/r2
l2/c
p/r3
l3/c
p/r4
l4/ctime
l1/c
p/r1 time
CS144, Stanford University 9
l1, r1 l2, r2 l3, r3 l4, r4A B
S1 S2 S3
Other packetsData H
Q2(t)
p/r1A
B
S1
S2
S3
p/r2
l1/c
l2/c
p/r3
p/r4
l3/c
l4/c
Q2(t)
time
*Queueing = UK spelling, adopted by Kleinrock at UCLA in 1960s. Queueing and queuing (US spelling) are both widely used.
CS144, Stanford University 10
Packet delay variation
0 100 200 300 400 500 600 7000%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
Stanford-Princeton4,000 km
Variation ~50ms
Stanford-Tsinghua10,000 km
Variation ~200ms
CDF (%)
RTT (ms)
CS144, Stanford University
Simple model of router queue
11
CS144, Stanford University 12
Simple model of a router queue
Properties of A(t), D(t):A(t), D(t) are non-decreasingA(t) >= D(t)
RA(t), l D(t)
Router queue
Q(t)
CS144, Stanford University 13
Simple model of a queue
A(t)
D(t)
Cumulative number of bytes departed up until time t.
time
Linkrate
Cum
ulati
venu
mbe
r of b
ytes
Cumulative number of bytes arrived up until time t.
R
A(t)
D(t)
Q(t)
Properties of A(t), D(t): A(t), D(t) are non-decreasing
A(t) >= D(t)
R
CS144, Stanford University 14
D(t)
A(t)
Time
Q(t)
d(t)
Queue occupancy: Q(t) = A(t) - D(t).
Queueing delay, d(t), is the time spent in the queue by a byte that arrived at time t, assuming the queue is served first-come-first-served (FCFS).
Simple model of a queueC
umul
ativ
enu
mbe
r of
byt
es
CS144, Stanford University 15
Example
Cum
ulati
venu
mbe
r of b
its
Every second, a 100 bit packet arrives to a queue at rate 1000b/s. The maximum
departure rate is 500b/s. What is the average occupancy of the queue?
D(t)
A(t)
time0.1s 0.2s 1.0s
100
Solution: During each repeating 1s cycle, the queue fills at rate 500b/s for 0.1s, then drains at rate 500b/s for 0.1s. Over the first 0.2s, the average queue occupancy is therefore bits.The queue is empty for 0.8s every cycle, and so average queue occupancy:
CS144, Stanford University
Priorities and Rates
16
CS144, Stanford University 17
FIFO is a free for all
R
B
CS144, Stanford University 18
Strict Priorities
R
High
Low
CS144, Stanford University 19
Weighted Priorities
R
Weight = 2
Weight = 1
CS144, Stanford University 20
Weighted Priorities
R
Weight = w1
Weight = wn
CS144, Stanford University 21
What we’d like
R
Weight = w1
Weight = wn
CS144, Stanford University 22
A practical way to do it
R
Weight = w1
Weight = wn
CS144, Stanford University 23
Finishing Time
Finishing time: bit-by-bit
Finishing time: pkt-by-pkt
CS144, Stanford University 24
Summary: Priorities and RatesFIFO queues are a free for all: No priorities and no guaranteed rates.
Strict priorities: High priority traffic “sees” a network with no low priority traffic. Useful if we have limited amounts of high priority traffic.
Weighted Fair Queueing (WFQ) lets us give each flow a guaranteed service rate, by scheduling them in order of their bit-by-bit finishing times.
CS144, Stanford University
Delay Guarantees
25
CS144, Stanford University 26
Delay guarantees: Intuition
l1, r1 l2, r2 l3, r3 l4, r4A B
Q2(t)Q1(t) Q3(t)
If we know the upper bound of Q1(t), Q2(t) and Q3(t), then we know the upper bound of the end-to-end delay.
CS144, Stanford University 27
Delay guarantees: Intuition
R
Rate = R1
Rate = Rn
CS144, Stanford University
So how can we control the delay of packets?
What we already know how to control:1. The rate at which a queue is served (WFQ).2. The size of each queue.
How do we make sure no packets are dropped?
CS144, Stanford University 29
Zooming in on one queue
R
BA(t) D(t)
time
Cumulativebytes
A(t) D(t)
R
Key idea: In general, we don’t know the arrival process. So let’s
constrain it.
CS144, Stanford University
Constraining traffic
time
Cumulativebits
r
s
t
Number of bits that can arrive in any period of length t
is bounded by:
This is called “( ,s r) regulation”
In our example: s = B and r = R1
CS144, Stanford University
( ,s r)-constrained Arrivals and Minimum Service Rate
time
Cumulativebits
A(t) D(t)
R1
r
s
dmax
Bmax
If flows are leaky-bucket constrained, and routers use WFQ, then end-to-end delay guarantees are possible.
CS144, Stanford University
The leaky bucket regulator
Tokensat rate, r
Token bucket
size, s
Packet buffer
Packets Packets
Send packet if and only if enough tokens
CS144, Stanford University 33
Putting it all together
A B
Q2(t)Q1(t)
Leaky BucketRegulator
CS144, Stanford University
An exampleIn the network below, an application wants a rate of 10Mb/s and
an end to end delay of less than 5ms for 1000byte packets.
A B10km, 1Gb/s 100km, 100Mb/s 10km, 1Gb/s
Once we decided to bound the delay to no more than 2.15ms in each router, we concluded that we need to make sure: (a) we don't store more than 2960 bytes in each router, which we accomplish by setting the token bucket at the source equal to 2960 bytes, and (b) the router buffer can hold at least 2960 bytes so we don't drop data (we can make the router buffer bigger if we'd like to; we just won't use it).
CS144, Stanford University 35
In practice
While it is technically possible to do so, very few networks actually control end to end delay.
Why?- It is complicated to make work, requiring coordination.- In most networks, a combination of over-provisioning
and priorities work well enough.
CS144, Stanford University 36
SummaryIf we know the size of a queue and the rate at which it is served, then we can bound the delay through it.
We can pick the size of the queue, and WFQ lets us pick the rate at which it is served.
Therefore, we just need a way to prevent packets being dropped along the way. For this, we use a leaky bucket regulator.
We can therefore bound the end to end delay.