140 likes | 318 Vues
Module 6.1: TCP Flow and Congestion Control. Connection establishment & Termination Flow Control Congestion Control QoS. Ch 22 Ch 23. Connection Establishment. Connection Termination. Flow Control. Some Points about TCP’s Sliding Windows:
E N D
Module 6.1: TCP Flow and Congestion Control • Connection establishment & Termination • Flow Control • Congestion Control • QoS Ch 22 Ch 23 K. Salah
Connection Establishment K. Salah
Connection Termination K. Salah
Flow Control • Some Points about TCP’s Sliding Windows: • A sliding window is used to make transmission more efficient as well as to control the flow of data so that the destination does not become overwhelmed with data. • It is called Selective Repeat ARQ. • Built on top of go-back-n ARQ • Accepts segments out of order, but error free • Repeat transmission of only selective segments • TCP’s sliding windows are byte oriented. TCP is a stream-oriented protocol. Data is presented as streams of characters. • The window size specifies the receiver’s current buffer size. • The source does not have to send a full window’s worth of data. • The size of the window can be increased or decreased by the destination. • The destination can send an acknowledgment at any time. K. Salah
TCP Sliding Window K. Salah
Corrupted Segment K. Salah
Lost Acknowledgement K. Salah
Silly Window Syndrome (SWS) • SWS occurs when each acknowledgement advertises a small amount of space available and each segment carries a small amount of data. • Avoidance • Receive-Side SWS Avoidance: Before sending an update window advertisement after advertising a zero window, wait for space to become available that is either at least 50% of the total buffer size or equal to a maximum sized segment. • Implementation using Delayed Acknowledgements • Ack every segment but with no increase in window size until sufficient size becomes available. • Delay Acks and Ack one with window size after sufficient size is available. Standards recommend this. • Advantage: decrease in traffic and overhead. • Disadvantage: sender may re-transmit due to long delays. K. Salah
Timers • Retransmission Timeout • If an acknowledgment is received for this particular segment before the timer goes off, the timer is destroyed. • If the timer goes off before the acknowledgment arrives, the segment is retransmitted and the timer is reset. • Round Trip delay may vary as packets and acks travel through the Internet. • Calculation • To accommodate the varying delays encountered in an internet environment, TCP uses an adaptive transmission algorithm that monitors delays on each connection and adjusts its timeout parameters accordingly. • RTT = ( * Old_RTT) + ((1-)*New_Round_Trip_Sample), 0< <1 • RTT = * RTT, recommended to be 2 K. Salah
Timers • Persistence Timer • TCP uses a persistence timer for each connection. When the sending TCP receives an acknowledgment with a window size of zero, it starts a persistence timer. • When the persistence timer goes off, the sending TCP sends a special segment called a probe. • A probe queries the receiver periodically to find out if the window has increased. The value of the timer changes and increases exponentially. • A probe contains only one byte of data. TCP is allowed to send 1 byte of data beyond the end of closed window. • Keepalive Timer • Used by the server to check if the client has crashed when the connection has been idle for a long time. • A probe message is sent for query. K. Salah
Congestion Control • Remember flow control is between Sender and Receiver, and Congestion Control takes care of congestion in the intermediate nodes (routers). • To avoid congestion collapse (I.e., network throughput to be zero), receiver controls the window size. • Allowed_Window =Min(receiver_advertisement, congestion_window) • Host can inject into the network as many segments as the receiver_advertisement (I.e. window size of the receiver) allows. • Congestion_window is for controlling congestion at the intermediate router • Initially congestion_window = receiver MSS • Congestion Avoidance is a combination of: • Slow-Start and Additive Increase: • Whenever starting traffic on a new connection or increasing traffic after a period of congestion, start the congestion window at the size of a single segment and increase the congestion window by one segment each time an acknowledgement arrives. • In order to avoid increasing the window size too quickly (I.e. exponential increase) and causing more congestion, apply additive increase, meaningonly increase window size by 1 after the size reaches the threshold. Initially threshold = ½ receiver_advertisement. • Multiplicative Decrease • Upon loss of a segment, reduce the congestion window down to one segment, and threshold = ½ last allowed window size. K. Salah
Increasing Strategy Initially advertisement_window = 32 segments. K. Salah
QoS Metrics • Reliability: Lack of reliability means losing a packet or acknowledgement, which entails retransmission • Delay: Source-to-destination delay. • Jitter: Variation in delay for packets belonging to the same flow. • Bandwidth: bits per second K. Salah