Advanced Networks 20021 Transport Layer - II Michalis Faloutsos Many slides from Kurose-Ross...
-
date post
21-Dec-2015 -
Category
Documents
-
view
219 -
download
0
Transcript of Advanced Networks 20021 Transport Layer - II Michalis Faloutsos Many slides from Kurose-Ross...
Advanced Networks 2002
1
Transport Layer - II
Michalis FaloutsosMichalis Faloutsos
Many slides from Kurose-RossMany slides from Kurose-Ross
Srikanth KrishnamurthySrikanth Krishnamurthy
S. KalyanaramanS. Kalyanaraman
Advanced Networks 2002
2
In this set of slides
TCP variantsTCP variants
Router assisted congestion controlRouter assisted congestion control
Advanced Networks 2002
3
Current TCP Versions
TCP specs can be implemented in different TCP specs can be implemented in different waysways
TCP versions:TCP versions:• Tahoe (basic as described)Tahoe (basic as described)• RenoReno• Las VegasLas Vegas
Advanced Networks 2002
4
TCP Reno
Most popular TCP implementationMost popular TCP implementationFast retransmit on 3 duplicate ACKsFast retransmit on 3 duplicate ACKsFast recovery: cancel slow start after fast Fast recovery: cancel slow start after fast retransmissionretransmission• Half the congestion window threshold, but start with Half the congestion window threshold, but start with
congestion window equal to thresholdcongestion window equal to threshold• Go to congestion avoidance phaseGo to congestion avoidance phase
Optimistic Rationale: Optimistic Rationale: I hope there was only one packet lostI hope there was only one packet lost Since I sent it, I hope it arrives this timeSince I sent it, I hope it arrives this time
Advanced Networks 2002
5
Fast RetransmitCoarse grained TCP time-outs sometimes lead to long periods Coarse grained TCP time-outs sometimes lead to long periods wherein a connection goes dead waiting for a timer to expire.wherein a connection goes dead waiting for a timer to expire.Fast Retransmit -- a heuristic that sometimes “triggers” the Fast Retransmit -- a heuristic that sometimes “triggers” the retransmission of a packet faster than permissible by the regular retransmission of a packet faster than permissible by the regular time-out.time-out.Every time a data packet arrives at a receiver, the receiver ACKs Every time a data packet arrives at a receiver, the receiver ACKs even though the particular sequence number has been ACKed.even though the particular sequence number has been ACKed.Thus, when a packet is received in out of order, resend the ACK Thus, when a packet is received in out of order, resend the ACK sent last time -- sent last time -- a duplicate ACKa duplicate ACK!!
60
20
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Time (seconds)
70
304050
10
Advanced Networks 2002
6
Duplicate ACKs
When a duplicate ACK is seen by the When a duplicate ACK is seen by the sender, it infers that the other side sender, it infers that the other side must have received a packet out of must have received a packet out of order.order.• Delays on different paths could be Delays on different paths could be
different -- thus, the missing packets may different -- thus, the missing packets may be delivered.be delivered.
• So wait for “some” number of duplicate So wait for “some” number of duplicate ACKs before resending data.ACKs before resending data.
• This number is usually 3.This number is usually 3.
Packet 1
Packet 2
Packet 3
Packet 4
Packet 5
Packet 6
Retransmitpacket 3
ACK 1
ACK 2
ACK 2
ACK 2
ACK 6
ACK 2
Sender Receiver
Advanced Networks 2002
7
Fast Recovery
When the fast retransmit mechanism signals When the fast retransmit mechanism signals congestion, the sender, instead of returning to Slow congestion, the sender, instead of returning to Slow Start uses a pure AIMD.Start uses a pure AIMD.• Simply reduces the congestion window by half and resumes Simply reduces the congestion window by half and resumes
additive increase.additive increase.
Thus, recovery is faster -- this is called Fast Thus, recovery is faster -- this is called Fast Recovery.Recovery.
Advanced Networks 2002
8
TCP Vegas
Idea: infer problems from RTT delayIdea: infer problems from RTT delay• Reduce rate before you have lossReduce rate before you have loss
What is a “sign” of congestion:What is a “sign” of congestion:• When RTT increases above a thresholdWhen RTT increases above a threshold• Sending rate flattensSending rate flattens
Decrease sending rate linearlyDecrease sending rate linearlyIssues:Issues:• Estimate RTTEstimate RTT• Set appropriate thresholdSet appropriate threshold
Intuition
Driving on Ice
60
20
0.5 1.0 1.5 4.0 4.5 6.5 8.0
KB
Time (seconds)
Time (seconds)
70
304050
10
2.0 2.5 3.0 3.5 5.0 5.5 6.0 7.0 7.5 8.5
900
300100
0.5 1.0 1.5 4.0 4.5 6.5 8.0
Se
nd
ing
KB
ps 1100
500700
2.0 2.5 3.0 3.5 5.0 5.5 6.0 7.0 7.5 8.5
Time (seconds)0.5 1.0 1.5 4.0 4.5 6.5 8.0
Qu
eu
e s
ize
in r
ou
ter
5
10
2.0 2.5 3.0 3.5 5.0 5.5 6.0 7.0 7.5 8.5
Congestion Window
Average send rate at source
Average Q length in router
Advanced Networks 2002
10
A Visit to Vegas
Having routers participate in congestion control Having routers participate in congestion control requires changes to core routers -difficult.requires changes to core routers -difficult.It is better to do this end-to-end.It is better to do this end-to-end.However, we want to still have source based control However, we want to still have source based control -- now, it would be source-based congestion -- now, it would be source-based congestion avoidance.avoidance.We need a TCP that watches out for signs of We need a TCP that watches out for signs of congestion --congestion --TCP VegasTCP Vegas..
Advanced Networks 2002
11
Noting RTT variations
How much does the RTT increase with each packet sent ?How much does the RTT increase with each packet sent ?• Note that with each additional packet, we are adding load.Note that with each additional packet, we are adding load.
One way -- compute for every two round trip delays (with an One way -- compute for every two round trip delays (with an increase in a segment) to see if observed RTT > avg of min increase in a segment) to see if observed RTT > avg of min and maximum RTT.and maximum RTT.If yes, reduce congestion window. If yes, reduce congestion window.
Advanced Networks 2002
12
A second possibility
Every RTT increase congestion window by a packet (or Every RTT increase congestion window by a packet (or segment).segment).Compute throughput as number of outstanding bytes Compute throughput as number of outstanding bytes divided by RTT.divided by RTT.Also keep the value of the throughput that was achieved Also keep the value of the throughput that was achieved when only one packet was in transit (at the beginning of when only one packet was in transit (at the beginning of the connection).the connection).If the difference between current throughput and this If the difference between current throughput and this above tagged throughput is less than 1/2 decrease above tagged throughput is less than 1/2 decrease congestion window by 1.congestion window by 1.
Advanced Networks 2002
13
TCP Vegas
Somewhat in line with what we saw in the previous examples.Somewhat in line with what we saw in the previous examples.
Source tries to match the available bandwidth exactly.Source tries to match the available bandwidth exactly.
TCP source maintains what is known as BaseRTT -- the RTT when TCP source maintains what is known as BaseRTT -- the RTT when the flow is not congested -- typically the minimum of all RTTs the flow is not congested -- typically the minimum of all RTTs observed.observed.
It uses this value to determine if or not congestion is being It uses this value to determine if or not congestion is being experienced.experienced.
Advanced Networks 2002
14
The TCP Vegas: Algorithm
Let BaseRTT be the minimum of all measured RTTs (commonly the Let BaseRTT be the minimum of all measured RTTs (commonly the RTT of the first packet)RTT of the first packet)If not overflowing the connection, thenIf not overflowing the connection, then• ExpectedRate = CongestionWindow / BaseRTTExpectedRate = CongestionWindow / BaseRTT
Source calculates current sending rate (ActualRate) once per RTTSource calculates current sending rate (ActualRate) once per RTTSource compares ActualRate with ExpectedRateSource compares ActualRate with ExpectedRate• Diff = ExpectedRate – ActualRateDiff = ExpectedRate – ActualRate• if Diff < if Diff <
-->increase CongestionWindow linearly -->increase CongestionWindow linearly • else if Diff >else if Diff >
-->decrease CongestionWindow linearly -->decrease CongestionWindow linearly • elseelse
-->leave CongestionWindow unchanged-->leave CongestionWindow unchanged
Advanced Networks 2002
15
Vegas Behavior
Green Line -- Expected throughputGreen Line -- Expected throughput
Black Line -- Actual throughputBlack Line -- Actual throughput
Shaded area -- region between Shaded area -- region between and and thresholds thresholds
70605040302010
Time (seconds)
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
2402001601208040
Time (seconds)
Advanced Networks 2002
16
ParametersParameters : 1 packet: 1 packet• : 3 packets: 3 packets
Even faster retransmitEven faster retransmit• keep fine-grained timestamps for each packetkeep fine-grained timestamps for each packet• check for timeout on first duplicate ACKcheck for timeout on first duplicate ACK
Vegas Parameters
Advanced Networks 2002
17
Principles of Congestion Control
Congestion:Congestion:informally: “too many sources sending too much informally: “too many sources sending too much data too fast for data too fast for networknetwork to handle” to handle”
different from flow control!different from flow control!
manifestations:manifestations:• lost packets (buffer overflow at routers)lost packets (buffer overflow at routers)• long delays (queueing in router buffers)long delays (queueing in router buffers)
Major research issueMajor research issue
Advanced Networks 2002
18
Consequences of Congestion
Large delays: throughput vs delay trade-offLarge delays: throughput vs delay trade-off• We don’t want to operate near capacityWe don’t want to operate near capacity
Finite buffers: lost packetsFinite buffers: lost packets
Resending of packets causesResending of packets causes• More packets for the same goodputMore packets for the same goodput• Wasted bandwidth of the packet that gets droppedWasted bandwidth of the packet that gets dropped
Advanced Networks 2002
19
Causes/costs of congestion: scenario 1
two senders, two two senders, two receiversreceivers
one router, one router, infinite buffers infinite buffers
no no retransmissionretransmission
large delays when large delays when congestedcongested
maximum maximum achievable achievable throughputthroughput
Advanced Networks 2002
20
Causes/costs of congestion: scenario 2
one router, one router, finitefinite buffers buffers
sender retransmission of lost packetsender retransmission of lost packet
Advanced Networks 2002
21
Causes/costs of congestion: scenario 2
Always: (goodput)Always: (goodput)
If packets are dropped:If packets are dropped:
in
out
=
’in
out
>
Advanced Networks 2002
22
Causes/costs of congestion: scenario 3 Four senders, multihop paths, timeout/retransmitFour senders, multihop paths, timeout/retransmitCongestion in one link -> retransmits -> congestion Congestion in one link -> retransmits -> congestion in other linksin other links
Advanced Networks 2002
23
Causes/costs of congestion: scenario 3
Another “cost” of congestion: when packet dropped, any “upstream transmission capacity used for that packet was wasted!
Advanced Networks 2002
24
Approaches towards congestion control
End-end congestion End-end congestion control:control:no explicit feedback from no explicit feedback from networknetwork
congestion inferred from congestion inferred from end-system observed loss, end-system observed loss, delaydelay
approach taken by TCPapproach taken by TCP
Network-assisted Network-assisted congestion control:congestion control:routers provide feedback to routers provide feedback to end systemsend systems• single bit indicating single bit indicating
congestion (SNA, DECbit, congestion (SNA, DECbit, TCP/IP ECN, ATM)TCP/IP ECN, ATM)
• explicit rate sender should explicit rate sender should send atsend at
Two broad approaches towards congestion control:
Advanced Networks 2002
25
Router Assisted Congestion Control
Random Early DetectionRandom Early Detection
Explicit Congestion NotificationExplicit Congestion Notification
Note: often this is referred to as Active Networking: ie Note: often this is referred to as Active Networking: ie routers are involved in perfomance.routers are involved in perfomance.
Active Nets is a much more general ideaActive Nets is a much more general idea
Advanced Networks 2002
26
RED: Random Early Detection
Idea: routers start dropping packets before Idea: routers start dropping packets before they are congestedthey are congestedBenefits: make behavior smootherBenefits: make behavior smootherHow:How:• When queue is above a When queue is above a thres-1thres-1: drop packets with : drop packets with
probability probability pp
Issues: Issues: • setting the parameterssetting the parameters• Estimating the queue sizeEstimating the queue size
Advanced Networks 2002
27
• two queue length thresholdstwo queue length thresholds if AvgLen if AvgLen MinThreshold then MinThreshold then
• enqueue the packet
if MinThreshold < AvgLen < MaxThresholdif MinThreshold < AvgLen < MaxThreshold• calculate probability P• drop arriving packet with probability P
if MaxThreshold if MaxThreshold AvgLen AvgLen• drop arriving packet
Thresholds
Advanced Networks 2002
28
RED: probability P
Not fixedNot fixedFunction of AvgLen and how long since Function of AvgLen and how long since last drop (count) keeps track of new last drop (count) keeps track of new packets that have been queued while packets that have been queued while AvgLen has been between the two AvgLen has been between the two thresholds thresholds • TempP = MaxP * (AvgLen - MinThreshold) /(MaxThreshold - TempP = MaxP * (AvgLen - MinThreshold) /(MaxThreshold -
MinThreshold)MinThreshold)• P = TempP/(1 - count * TempP)P = TempP/(1 - count * TempP)
MaxP is often set to 0.02, meaning that the MaxP is often set to 0.02, meaning that the gateway drops 1 out of 50 packets when gateway drops 1 out of 50 packets when queue size is halfway between queue size is halfway between MinThreshold and MaxThresholdMinThreshold and MaxThreshold
Advanced Networks 2002
29
Comments on RED
Probability of dropping a particular flow's Probability of dropping a particular flow's packet(s) is roughly proportional to the share packet(s) is roughly proportional to the share of the bandwidth that flow is currently gettingof the bandwidth that flow is currently getting
MaxP is typically set to 0.02, meaning that MaxP is typically set to 0.02, meaning that when the average queue size is halfway when the average queue size is halfway between the two thresholds, the gateway between the two thresholds, the gateway drops roughly one out of 50 packets. drops roughly one out of 50 packets.
Advanced Networks 2002
30
RED: Dropping probability
P(drop)
1.0
MaxP
MinThresh MaxThresh
AvgLen
Advanced Networks 2002
31
Selecting Parameters
if traffic is bursty, then MinThreshold if traffic is bursty, then MinThreshold should be sufficiently large to allow link should be sufficiently large to allow link utilization to be maintained at an utilization to be maintained at an acceptably high levelacceptably high levelThe difference between two thresholds The difference between two thresholds should be larger than the typical increase should be larger than the typical increase in the calculated average queue length in in the calculated average queue length in one RTT; setting MaxThreshold to twice one RTT; setting MaxThreshold to twice MinThreshold is reasonable for traffic on MinThreshold is reasonable for traffic on today's Internettoday's Internet
Advanced Networks 2002
32
Explicit Congestion Notification
Dropping packets = Warn of congestionDropping packets = Warn of congestion
Idea: mark packets to notify congestionIdea: mark packets to notify congestion
How:How:• Congested router marks packet (sets a bit)Congested router marks packet (sets a bit)• Receiver “copies” bit in the ACKReceiver “copies” bit in the ACK• Sender reduces its windowSender reduces its window
Benefit: proactive without losing packetsBenefit: proactive without losing packets
Problem: sender can ignore itProblem: sender can ignore it
Advanced Networks 2002
33
Current Beliefs
RED + ECN are considered to be goodRED + ECN are considered to be good
RED alone has problemsRED alone has problems
Advanced Networks 2002
34
Summary
principles behind transport principles behind transport layer services:layer services:• multiplexing/demultiplexingmultiplexing/demultiplexing• reliable data transferreliable data transfer• flow controlflow control• congestion controlcongestion control
instantiation and instantiation and implementation in the Internetimplementation in the Internet• UDPUDP• TCPTCP
Advanced Networks 2002
35
TCP Flow Control
receiver:receiver: explicitly explicitly informs sender of informs sender of (dynamically (dynamically changing) amount of changing) amount of free buffer space free buffer space • RcvWindow RcvWindow fieldfield in in
TCP segmentTCP segment
sender:sender: keeps the keeps the amount of transmitted, amount of transmitted, unACKed data less unACKed data less than most recently than most recently received received RcvWindowRcvWindow
sender won’t overrunreceiver’s buffers by
transmitting too much, too fast
flow control
receiver buffering
RcvBuffer = size or TCP Receive Buffer
RcvWindow = amount of spare room in Buffer
Advanced Networks 2002
41
TCP Vegas Details
Value of throughput with no congestion is compared Value of throughput with no congestion is compared to current throughputto current throughputIf current difference is small, increase window size If current difference is small, increase window size linearlylinearlyIf current difference is large, decrease window size If current difference is large, decrease window size linearlylinearlyThe change in the Slow Start Mechanism consists of The change in the Slow Start Mechanism consists of doubling the window every other RTT, rather than doubling the window every other RTT, rather than every RTT and of using a boundary in the difference every RTT and of using a boundary in the difference between throughputs to exit the Slow Start phase, between throughputs to exit the Slow Start phase, rather than a window size value. rather than a window size value.
Advanced Networks 2002
42
Expected and Actual Rates
The source computes an Expected Rate -- Expected Rate = The source computes an Expected Rate -- Expected Rate = CongestionWindow/BaseRTTCongestionWindow/BaseRTT
Actual Rate is also computed -- number of bytes transmitted Actual Rate is also computed -- number of bytes transmitted during the RTT of a tagged packet.during the RTT of a tagged packet.
Diff = Expected Rate - Actual Rate.Diff = Expected Rate - Actual Rate.
Note that the Diff is always greater than or equal to zero Note that the Diff is always greater than or equal to zero (BaseRTT is the lowest !). (BaseRTT is the lowest !).
Advanced Networks 2002
43
Vegas Rules
Define two thresholds Define two thresholds and and ..
If Diff < If Diff < , TCP vegas increases congestion window linearly , TCP vegas increases congestion window linearly during next RTT.during next RTT.
If Diff > If Diff > , it decreases the congestion window linearly., it decreases the congestion window linearly.
If If < Diff < < Diff < , TCP vegas leaves the congestion window as , TCP vegas leaves the congestion window as is. is.