lab the network simulator ns the network simulator ns allows us to watch evolution of parameters...
TRANSCRIPT
LabLab
The network simulator The network simulator nsns
Allows us to watch evolution of parameters Allows us to watch evolution of parameters like like cwnd cwnd and and ssthreshssthresh
ns output is in “raw” form; ns output is in “raw” form; needs needs processingprocessing
awk awk is often very useful for thisis often very useful for this
Implication of a time-outImplication of a time-out
When a packet is lost, we stop getting When a packet is lost, we stop getting new new acksacks
Left edge stops moving to the rightLeft edge stops moving to the right
Dup acks come; suppose no fast retransmitDup acks come; suppose no fast retransmit
Transmitter keeps sending till it exhausts Transmitter keeps sending till it exhausts the usable windowthe usable window
At this point, the transmitter stallsAt this point, the transmitter stalls
Implication of a time-outImplication of a time-out What is happening to the segments What is happening to the segments already already
in the pipe?in the pipe?
They keep progressing to the receiver, and They keep progressing to the receiver, and acks keep getting generatedacks keep getting generated
But these are all dup acksBut these are all dup acks
As the transmitter is not putting new As the transmitter is not putting new packets into the pipe, eventually the pipe packets into the pipe, eventually the pipe empties outempties out
Eventually, pipe is empty
Implication of a time-outImplication of a time-out
If If RTO timer value is “appropriately” set, RTO timer value is “appropriately” set, then by the time the timer fires, then by the time the timer fires, the pipe will the pipe will have emptied outhave emptied out
This is because RTO is set sufficiently largeThis is because RTO is set sufficiently large
Same situation as when we beganSame situation as when we began
Hence the need for Hence the need for Slow Start Slow Start after time-outafter time-out
Fast RetransmitFast Retransmit
However, if we do a Fast Retransmit, However, if we do a Fast Retransmit, then the pipe is then the pipe is notnot empty when we empty when we retransmitretransmit
In particular, if the duplicate ack In particular, if the duplicate ack threshold threshold KK is a small fraction of the is a small fraction of the BDPBDP, the pipe is almost full when the , the pipe is almost full when the fast retransmit happensfast retransmit happens
– Hence, no need for Slow Start!Hence, no need for Slow Start!
Fast RetransmitFast Retransmit
Further, Further, KK dup acks mean that dup acks mean that KK packets packets have left the networkhave left the network
By “By “packet conservationpacket conservation”, can send ”, can send KK more packets!more packets!
Fast recoveryFast recovery Suppose that Suppose that cwndcwnd = = C (packets)C (packets)
This means that the source estimates that the This means that the source estimates that the pipe can hold C packets presentlypipe can hold C packets presently
Suppose that D Suppose that D dup acksdup acks are receivedare received
This means that D packets have left the pipeThis means that D packets have left the pipe– A A dup ack dup ack is generated as soon as the out-of-order is generated as soon as the out-of-order
packet reaches the receiverpacket reaches the receiver
So, D packets can be injected into the network So, D packets can be injected into the network
Fast recoveryFast recovery Observation:Observation:
In order to send D packets, need to set In order to send D packets, need to set
cwndcwnd = = C + DC + D
This is as if This is as if cwnd cwnd was was inflated inflated (by 1) for every (by 1) for every dup ack receiveddup ack received
So, upon receiving the So, upon receiving the KKth th dup ackdup ack– ssthresh = (1/2)*cwnd ssthresh = (1/2)*cwnd (Usual step in CA)(Usual step in CA)– Retransmit the lost packetRetransmit the lost packet
Fast RecoveryFast Recovery After Fast Retransmit, set After Fast Retransmit, set cwndcwnd = =
ssthreshssthresh + + KK
Keep increasing Keep increasing cwndcwnd by 1 for every by 1 for every duplicate ack receivedduplicate ack received
This is the idea ofThis is the idea of Fast RecoveryFast Recovery
Keep transmitting packets whenever Keep transmitting packets whenever allowed by the value ofallowed by the value of cwndcwnd
Fast RecoveryFast Recovery When the (fast) retransmitted packet is When the (fast) retransmitted packet is
acknowledged, set acknowledged, set cwnd = ssthreshcwnd = ssthresh again again (cwnd (cwnd deflateddeflated))
Ready to begin next cycleReady to begin next cycle
Note that we are not beginning in Slow StartNote that we are not beginning in Slow Start
Beginning in Congestion Avoidance insteadBeginning in Congestion Avoidance instead
Initial “slowness” of Slow Start avoidedInitial “slowness” of Slow Start avoided
Overall speed of data transfer improvedOverall speed of data transfer improved
Fast Retransmit & Fast Fast Retransmit & Fast RecoveryRecovery
Reasons for improved performanceReasons for improved performance
– Early detection of congestion (triple duplicate Early detection of congestion (triple duplicate acks) and early retransmissionacks) and early retransmission
– If retransmitted packet was successfully If retransmitted packet was successfully received, next cycle begins in Congestion received, next cycle begins in Congestion Avoidance and not Slow StartAvoidance and not Slow Start
– However, if retransmission is not successful, However, if retransmission is not successful, then next cycle begins in Slow Start again (no then next cycle begins in Slow Start again (no choice)choice)
Fast Retransmit & Fast Fast Retransmit & Fast RecoveryRecovery
SS Loss detection(triple duplicate ack)
Fast retransmitcwnd=ssthresh + 3
cwnd inflated for everyduplicate ack; keep transmitting if possible
Fast recovery
Hopefully, retransmission succeeded
cwnd=ssthresh
Beginning the nextcycle in congestionavoidance
cwnd=1
Retransmissionfailed & timeout
SS
Triple duplicateack
ssthresh=(1/2)*cwnd
RetransmissionsRetransmissions
Measurementsfor obtaining RTT
RTO calculations(parameters)
RTT measurementsRTT measurements Not all transmitted segments are timedNot all transmitted segments are timed
One connection is associated with one timerOne connection is associated with one timer– If the timer is already in use when a segment S is If the timer is already in use when a segment S is
transmitted, the segment S is not timedtransmitted, the segment S is not timed
cwnd = 1
ack
cwnd = 2
ack
Segmentnot timed
RTT measurementsRTT measurements
RTTRTT: : time between sending a byte with a time between sending a byte with a particular sequence number and getting an particular sequence number and getting an ack covering that sequence numberack covering that sequence number
Timing: counting ticks that occur every 500 Timing: counting ticks that occur every 500 msms
Only segments containing data are timedOnly segments containing data are timed
– A segment with only an Ack will not be timedA segment with only an Ack will not be timed
RTT measurementsRTT measurements
If 1 tick between transmission of data and If 1 tick between transmission of data and reception of ack, then RTT is taken to be reception of ack, then RTT is taken to be 500 ms500 ms
– If 2 ticks, then RTT taken to be 1000 msIf 2 ticks, then RTT taken to be 1000 ms
What should we do if a packet is What should we do if a packet is retransmitted?retransmitted?
RTT MeasurementsRTT Measurements
A packet is transmitted, a timeout occurs, A packet is transmitted, a timeout occurs, the packet is retransmittedthe packet is retransmitted
Now an ack is receivedNow an ack is received
Ack corresponding to the 1st transmission Ack corresponding to the 1st transmission or the 2nd?or the 2nd?
– Retransmission ambiguity problemRetransmission ambiguity problem
RTT MeasurementsRTT Measurements
Difficulty: Not sure if the 1Difficulty: Not sure if the 1stst transmission transmission was lostwas lost
Perhaps the RTO was too small and the Perhaps the RTO was too small and the retransmission happened too soonretransmission happened too soon
Karn’s algorithmKarn’s algorithm
Upon loss detected by time-out, back off Upon loss detected by time-out, back off the RTO timerthe RTO timer
– Exponential backoff: double the RTO interval Exponential backoff: double the RTO interval upon a time-outupon a time-out
– Continues till an upper limit is reachedContinues till an upper limit is reached
– Allowing time for congestion to clear outAllowing time for congestion to clear out
Karn’s algorithmKarn’s algorithm
Ack for a retransmitted packet arrivesAck for a retransmitted packet arrives
– No updates of the RTT estimatesNo updates of the RTT estimates
– No change in RTO values being used currentlyNo change in RTO values being used currently
– Update estimates when ack received for a Update estimates when ack received for a segment that was not retransmittedsegment that was not retransmitted
RTT estimates and RTORTT estimates and RTO
How long should the time-out interval (RTO) How long should the time-out interval (RTO) be?be?
AdaptiveAdaptive
– Should depend on the round-trip time (RTT) Should depend on the round-trip time (RTT) experienced on a connectionexperienced on a connection
Therefore, need to keep measuring RTTsTherefore, need to keep measuring RTTs
RTT estimates and RTORTT estimates and RTO Denote the measured RTT value by MDenote the measured RTT value by M
[RFC 793] R: “running” estimate of avg RTT[RFC 793] R: “running” estimate of avg RTT – R <--- R <--- R + (1-R + (1-)M)M– Smoothed estimatorSmoothed estimator = 0.9= 0.9 (recommended)(recommended)
Round-trip timeoutRound-trip timeout– RTO = RTO = RR recommendedrecommended
Experience showed that this setting of RTO did not Experience showed that this setting of RTO did not work well (Jacobson)work well (Jacobson)
RTT estimates and RTORTT estimates and RTO
Variability in RTT is not adequately Variability in RTT is not adequately capturedcaptured– Leads to unnecessary retransmissionsLeads to unnecessary retransmissions
Keep track of the variability in RTTKeep track of the variability in RTT– Calculate RTO based on both mean and mean Calculate RTO based on both mean and mean
deviation of RTTdeviation of RTT
A: running estimate of avg RTTA: running estimate of avg RTT– Err = (M - A)Err = (M - A)– ““Error” between measured value and estimateError” between measured value and estimate
RTT estimates and RTORTT estimates and RTO
AlgorithmAlgorithm– Update A:Update A: A <-- (1 - g) A + g MA <-- (1 - g) A + g M– g = 0.125g = 0.125
D: running estimate of deviationD: running estimate of deviation– Update D:Update D: D <-- (1 - h) D + h | Err |D <-- (1 - h) D + h | Err |– h = 0.25h = 0.25
RTO = A + 4DRTO = A + 4D