160 likes | 409 Views
CS716 Advanced Computer Networks By Dr. Amir Qayyum. 1. Lecture No. 32. TCP Flow Control Issues. Problem: app. delivers tiny pieces of data to TCP e.g . telnet in character mode Each piece sent as segment, returned as ACK Very inefficient Solutions
E N D
CS716 Advanced Computer Networks By Dr. Amir Qayyum 1
TCP Flow Control Issues • Problem: app. delivers tiny pieces of data to TCP • e.g. telnet in character mode • Each piece sent as segment, returned as ACK • Very inefficient • Solutions • Delay transmission to accumulate more data • Nagle’s algorithm • Send first piece • Accumulate data until first piece ACK’d • Send accumulated data and restart accumulation • Not ideal for some traffic, e.g. mouse motion
TCP Flow Control Issues • Problem: slow application reads data in tiny pieces • Receiver advertises tiny window • Sender fills tiny window • Known as silly window syndrome • Solution: due to Clark • Advertise window opening only when MSS or ½ of buffer is available • Sender delays sending until window is MSS or ½ of receiver’s buffer (estimated) • Overridden by using PUSH
TCP Flow Control Math • Send buffer size: MaxSendBuffer • Receive buffer size: MaxRcvBuffer • Receiving side • LastByteRcvd - LastByteRead < = MaxRcvBuffer • AdvertisedWindow = MaxRcvBuffer - (NextByteExpected - NextByteRead) • Sending side • LastByteSent - LastByteAcked < = AdvertisedWindow • EffectiveWindow = AdvertisedWindow - (LastByteSent - LastByteAcked) • LastByteWritten - LastByteAcked < = MaxSendBuffer • block sender if (LastByteWritten - LastByteAcked) + y > MaxSenderBuffer • Always send ACK in response to arriving data segment • Persist when AdvertisedWindow= 0
TCP Bit Allocation Limitations • Sequence numbers vs packet lifetime • Assumed that IP packets live less than 60s • Can we send 232 (4G) bytes in 60 seconds ? • Only need a data rate of 573 Mbps! • Less than an STS-12 line... (less than Gigabit Ethernet) • Advertised window vs delay-bandwidth • Only 16 bits (64kB) for advertised window • For cross-country RTT of 100 milliseconds, adequate for a mere 5.24 Mbps!
Protection Against Wrap Around • 32-bit SequenceNum Bandwidth Time Until Wrap Around T1 (1.5 Mbps) 6.4 hours Ethernet (10 Mbps) 57 minutes T3 (45 Mbps) 13 minutes FDDI (100 Mbps) 6 minutes STS-3 (155 Mbps) 4 minutes STS-12 (622 Mbps) 55 seconds STS-24 (1.2 Gbps) 28 seconds
Keeping the Pipe Full • 16-bit AdvertisedWindow Bandwidth Delay x Bandwidth Product T1 (1.5 Mbps) 18KB Ethernet (10 Mbps) 122KB T3 (45 Mbps) 549KB FDDI (100 Mbps) 1.2MB STS-3 (155 Mbps) 1.8MB STS-12 (622 Mbps) 7.4MB STS-24 (1.2 Gbps) 14.8MB
Adaptive Retransmission Algorithm • Original algorithm used only RTT estimate • Theory: measure RTT for each segment + its ACK • Estimate RTT • Timeout is 2 × RTT to allow for variations
Adaptive Retransmission Algorithm • Practice • Use exponential moving average ( = 0.8 to 0.9) • Estimate = × estimate + (1 - ) measurement Measured RTT depends on time
Adaptive Retransmission Algorithm • Problem: it did not handle variations well • Ambiguity for retransmitted packets: was ACK in response to first, second, etc. transmission ? Measured RTT time transmission retransmission RTT ? ? ?
Adaptive Retransmission (Original Algorithm) • Measure SampleRTT for each segment/ACK pair • Compute weighted average of RTT • EstRTT = a×EstRTT + b×SampleRTT • where a+b = 1 • a between 0.8 and 0.9 • b between 0.1 and 0.2 • Set timeout based on EstRTT • TimeOut=2×EstRTT
Karn/Partridge Algorithm Sender Receiver Sender Receiver • Do not sample RTT when retransmitting • Double timeout (RTT estimate) after each retransmission • Still did not handle variations well • Did not solve network congestion problems as desired Original transmission Original transmission TT TT ACK Retransmission SampleR SampleR Retransmission ACK
Jacobson/Karels Algorithm • Estimate variance of RTT • Calculate mean interpacket RTT deviation as an approximation of variance (Diff = RTT_estimate – measurement) • RTT_estimate = ax RTT_estimate + (1 - a )× measurement • Using another exponential moving average • Deviation = β x |RTT_estimate - measurement| + (1 - β) deviation • β = 0.25, α = 0.875 in RTT_estimate
Jacobson/Karels Algorithm • Use variance estimate as component of RTT estimate • next_RTT (timeout) = RTT_estimate + 4 × deviation • Protects against high jitter • Algorithm only as good as clock granularity(500ms on Unix) • Accurate timeout mechanism important to congestion control