1
1
EE 122: Final Review Ion Stoica
TAs: Junda Liu, DK Moon, David Zats
http://inst.eecs.berkeley.edu/~ee122/fa09 (Materials with thanks to Vern Paxson, Jennifer Rexford,
and colleagues at UC Berkeley)
Announcements
Project 2 due Friday, Dec 11, 11:59pm
Final exam: Dec 17, 8-11am, 10 Evans Hall
My office hours next week My office hours: MW 10-11:30am The office hours of everyone else unchanged
Final Exam
Open book, open notes! Crib sheets ok if you like
Comprehensive, but greater focus on material since midterm
Questions similar in format to the first midterm Problem set-up descriptions + multipart fill-ins
All answers on the exam sheets we hand out Bring PENCIL, ERASER, no calculators needed
Outline
Persistent Oscillations TCP Multicast: DVRMP Token Bucket Integrated & Differentiated Services Routing in Chord
2
5
Routing: Persistent Oscillations Assume link cost = amount of carried traffic
A
D
C
B 0 0
0 0 0 0
No traffic
A
D
C
B 1 1
0 0 0 0
B to A: 1 unit of traffic D to A: 1 unit of traffic
1 1
A
D
C
B 1 1+e
e 1 0 0
CA: e units of traffic
1 1 e
6
Routing: Persistent Oscillations Assume link cost = amount of carried traffic
A
D
C
B 1 1+e
e 0
e 1 1
0 0
A
D
C
B 2+e 0
0 0 1+e 1
B to A: cost(BCDA) = 1 lower than cost(BA) = 1+e
C to A: cost(CDA) = 1 lower than cost(CBA) = 1+2*e
1 1 e
B to A: switches to BCDA
C to A: switches to CDA
7
Routing: Persistent Oscillations Assume link cost = amount of carried traffic
A
D
C
B 2+e 0
0 0
e 1 1
1+e 1
B to A: cost(BA) = 0 lower than cost(BCDA) = 4+2*e C to A: cost(CBA) = 0 lower than cost(CDA) = 3+2*e D to A: cost(DCBA) = 0 lower than cost(DA) = 2+e
B to A: switches to BA
C to A: switches to CBA
D to A: switches to DCBA
A
D
C
B 0 2+e
1+e 1 0 0
1 1 e
8
Routing: Persistent Oscillations Assume link cost = amount of carried traffic
B to A: cost(BCDA) = 0 lower than cost(BCDA) = 4+2*e C to A: cost(CBA) = 0 lower than cost(CDA) = 3+2*e D to A: cost(DCBA) = 0 lower than cost(DA) = 2+e
B to A: switches to BCDA
C to A: switches to CDA
D to A: switches to DA
A
D
C
B 0 2+e
1+e 1 0 0
1 1 e
A
D
C
B 2+e 0
e 0 1+e 1
1 1 e
3
Outline
Persistent Oscillations TCP Wireless MAC Multicast: DVRMP Token Bucket Integrated & Differentiated Services Routing in CAN & Chord
TCP Congestion Control
Flow control keeps one fast sender from overwhelming a slow receiver
Congestion control keeps a set of senders from overloading the network
Three congestion control problems: Adjusting to bottleneck bandwidth
Without any a priori knowledge Could be a Gbps link; could be a modem
Adjusting to variations in bandwidth Sharing bandwidth between flows
11
The big picture (with timeouts)
Time
cwnd
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
12
The big picture (with timeouts)
Time
cwnd
Slow Start
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
4
13
The big picture (with timeouts)
Time
cwnd
Timeout
Slow Start
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
1/2 cwnd
ssthresh
14
The big picture (with timeouts)
Time
cwnd
Timeout
Slow Start
1/2 cwnd
ssthresh
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
Slow Start
15
The big picture (with timeouts)
Time
cwnd
Timeout
Slow Start
AIMD
ssthresh
Slow Start
1/2 cwnd
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
16
The big picture (with timeouts)
Time
cwnd
Timeout
Slow Start
AIMD Timeout
ssthresh
Slow Start
1/2 cwnd
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
5
17
The big picture (with timeouts)
Time
cwnd
Timeout
Slow Start
AIMD Timeout
ssthresh
Slow Start
Slow Start
AIMD
1/2 cwnd
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
18
The big picture (with timeouts)
Time
cwnd
AIMD
Timeout
Slow Start
AIMD
Initially: cwnd = 1; ssthresh = infinite;
New ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd;
Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
AIMD
Slow Start
sstresh
19
Congestion Detection Revisited
Wait for Retransmission Time Out (RTO) RTO kills throughput
In BSD TCP implementations, RTO is usually more than 500ms The granularity of RTT estimate is 500 ms Retransmission timeout is RTT + 4 * mean_deviation
Solution: Don’t wait for RTO to expire
20
Fast Retransmits
Resend a segment after 3 duplicate ACKs Duplicate ACK means
that an out-of sequence segment was received
Notes: ACKs are for next
expected packet Packet reordering can
cause duplicate ACKs Window may be too
small to get enough duplicate ACKs
ACK 2
segment 1 cwnd = 1
cwnd = 2 segment 2 segment 3
ACK 4 cwnd = 4 segment 4
segment 5 segment 6 segment 7
ACK 3
3 duplicate ACKs
ACK 4
ACK 4
ACK 4
6
21
Fast Retransmit and Fast Recovery
Retransmit after 3 duplicated acks Prevent expensive timeouts
Reduce slow starts At steady state, cwnd oscillates around
the optimal window size
Time
cwnd
Slow Start
AIMD
Fast retransmit
22
Fast Recovery: After a Fast Retransmit ssthresh = cwnd / 2 cwnd = ssthresh
Instead of setting cwnd to 1, cut cwnd in half (multiplicative decrease)
For each dup ack arrival dupack++ Indicates packet left network, so we may be able to send more MaxWindow = min(cwnd + dupack, AdvWin)
Receive ack for new data (beyond initial dup ack) dupack = 0 Exit fast recovery
But when RTO expires still do cwnd = 1
Outline
Persistent Oscillations TCP Multicast: DVRMP Token Bucket Integrated & Differentiated Services Routing in CAN & Chord
Distance Vector Multicast Routing Protocol (DVRMP)
An elegant extension to DV routing Use shortest path DV routes to determine if link
is on the source-rooted spanning tree Three steps in developing DVRMP
Reverse Path Flooding Reverse Path Broadcasting Truncated Reverse Path Broadcasting
7
Reverse Path Flooding What: node Y forwards
packet from node X to all its neighbors
(except X), iff X is the next hop
of Y to source (A) How: just use unicast
routing tables Why: eliminate the
loops of simple flooding protocol
4
2
10
3
6
8 9
1
5 7
A
D
B
C
E F
G
H
Unicast shortest path Multicast data packets Packets not forwarded
Reverse Path Flooding What: node Y forwards
packet from node X to all its neighbors
(except X), iff X is the next hop
of Y to source (A) How: just use unicast
routing tables Why: eliminate the
loops of simple flooding protocol
4
2
10
3
6
8 9
1
5 7
A
D
B
C
E F
G
H
Unicast shortest path Multicast data packets Packets not forwarded
Duplicate packet
Reverse Path Broadcasting
What: node X forwards packet to node Y iff X is next hop of Y to source (A)
How: X infers this info from routing messages (see multicast lecture)
Why: Avoid a router receiving duplicate packets
4
2
10
3
6
8 9
1
5 7
A
D
B
C
E F
G
H
Unicast shortest path Multicast data packets
Truncated Reverse Broadcasting
What: don’t forward packets to non-members
How: use prune messages
Why: eliminate un-needed forwarding
4
2
10
3
6
8 9
1
5 7
A
D
B
C
E F
G
H
Unicast shortest path Multicast data packets Non-membership report Subscription message
8
Truncated Reverse Broadcasting
What: don’t forward packets to non-members
How: use prune messages
Why: eliminate un-needed forwarding
4
2
10
3
6
8 9
1
5 7
A
D
B
C
E F
G
H
Unicast shortest path Multicast data packets Non-membership report Subscription message
Pruning Details
Prune (Source,Group) at leaf if no members Send Non-Membership Report (NMR) up tree
If all children of router R send NRM, prune (S,G) Propagate prune for (S,G) to parent R
On timeout: Prune dropped Flow is reinstated Down stream routers re-prune
Note: a soft-state approach
Outline
Persistent Oscillations TCP Multicast: DVRMP Token Bucket Integrated & Differentiated Services Routing in Chord
Token Bucket and Arrival Curve
Parameters r – average rate, i.e., rate at which tokens fill the bucket b – bucket depth R – maximum link capacity or peak rate (optional parameter)
A bit is transmitted only when there is an available token Arrival curve – maximum number of bits transmitted within an
interval of time of size t
r bps
b bits
<= R bps
regulator time
bits
b*R/(R-r)
slope R
slope r
Arrival curve
9
Traffic Enforcement: Example r = 100 Kbps; b = 3 Kb; R = 500 Kbps
3Kb
T = 0 : 1Kb packet arrives
(a)
2.2Kb
T = 2ms : packet transmitted b = 3Kb – 1Kb + 2ms*100Kbps = 2.2Kb
(b)
2.4Kb
T = 4ms : 3Kb packet arrives
(c)
3Kb
T = 10ms : packet needs to wait until enough tokens are in the bucket!
(d)
0.6Kb
T = 16ms : packet transmitted
(e)
Source Traffic Characterization: Arrival Curve
Arrival curve – maximum amount of bits transmitted during any interval of time Δt
Use token bucket to bound arrival curve
Δt
bits
Arrival curve
time
bps
Arrival Curve: Example Arrival curve – maximum amount of bits
transmitted during any interval of time Δt Use token bucket to bound arrival curve
bits Arrival curve
time
bps
0 1 2 3 4 5
1
2
1 2 3 4 5
1
2
3
4
(R=2,b=1,r=1)
Δt
Per-hop Reservation End-host: specify
the arrival rate characterized by token-bucket with parameters (b,r,R) the maximum maximum admissible delay D
Router: allocate bandwidth ra and buffer space Ba such that no packet is dropped no packet experiences a delay larger than D
bits
b*R/(R-r)
slope r Arrival curve
D Ba
slope ra
10
Outline
Persistent Oscillations TCP Multicast: DVRMP Token Bucket Integrated and Differentiated Services Routing in CAN & Chord
Integrated Services
Provide service guarantees at a per-flow granularity
Reservation Protocol How service request gets from host to network
Admission control algorithm How network decides if it can accept flow
Packet scheduling algorithms How routers deliver service
Control Plane: Resource Reservation
Sender Receiver
Control Plane: Resource Reservation
Sender Receiver
Sender sends specification of traffic profile
11
Control Plane: Resource Reservation
Sender Receiver Path established (or perhaps admission control denies path)
Control Plane: Resource Reservation
Sender Receiver
The receiver accepts reservation request
Control Plane: Admission Control
Sender Receiver
Per-flow state (soft state)
Sender Receiver
Control Plane: Admission Control
Per-flow state on all routers in path
12
Data Plane
Sender Receiver
Per-flow classification on each router
Data Plane
Sender Receiver
Per-flow classification on each router
Data Plane
Sender Receiver Per-flow scheduling on each router
Differentiated Services (DiffServ) Give some traffic better treatment than other
App. requirements: interactive vs. bulk transfer Economic arrangements: first-class versus coach
What kind of better service could you give? Fewer drops Lower delay Lower delay variation (jitter)
How to know which packets get better service? Bits in packet header
Deals with traffic in aggregate Provides weaker services But much more scalable
13
Diffserv Architecture Ingress routers - entrance to a DiffServ domain
Police or shape traffic Set Differentiated Service Code Point (DSCP) in IP header
Core routers Implement Per Hop Behavior (PHB) for each DSCP Process packets based on DSCP
Ingress Egress
Ingress Egress
DS-1 DS-2
Edge router Core router
Differentiated Services
Expedite Forwarding (EF) Give packet minimal delay and loss service P-bit denotes premium traffic
Assured Forwarding (AS) Packets are all serviced in order
Makes TCP implementations perform well
But some packets can be marked as low-drop Think of it as priority levels for dropping
A-bit denotes assured traffic
Comparison to Best-Effort & Intserv
Best-Effort Diffserv Intserv
Service Connectivity No isolation No guarantees
Per aggregate isolation Per aggregate guarantee
Per flow isolation Per flow guarantee
Service scope
End-to-end Domain End-to-end
Complexity No setup Long term setup Per flow steup
Scalability Highly scalable (nodes maintain only routing state)
Scalable (edge routers maintain per aggregate state; core routers per class state)
Not scalable (each router maintains per flow state)
Outline
Persistent Oscillations TCP Multicast: DVRMP Token Bucket Integrated & Differentiated Services Routing in CAN & Chord
14
Routing in CAN
O(d*N1/d) d: dimensions N: number of nodes
Example: route from S to D on a 2-dimensional grid d = 2 N = m x m Path length: 2*m =
2*N1/2
S
D
m
m
Routing in Chord using Fingers
Finger i at node n:
80 + 20!80 + 21!
80 + 22!80 + 23!
80 + 24!
80 + 25!
(80 + 26) mod 27 = 16!0
32
45 80
20 112
96
i ft[i] 0 96 1 96 2 96 3 96 4 96
5 112 6 20
55 70
Routing in Chord using Fingers
Route length: O(log N) N: number of nodes
Justification: every hop reduces the distance to destination by at least half
0
32
45 80
20 112
96
55 70 S
D
Recursive vs. Iterative Routing
0
32
45 80
20 112
96
55 70 S
D
0
32
45 80
20 112
96
55 70 S
D
Recursive Iterative
15
Final Exam
Open book, open notes! Crib sheets ok if you like
Comprehensive, but greater focus on material since midterm
Questions similar in format to the first midterm Problem set-up descriptions + multipart fill-ins
All answers on the exam sheets we hand out Bring PENCIL, ERASER, no calculators needed