anuragjagetiya
11,972 views
33 slides
May 13, 2015
Slide 1 of 33
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
About This Presentation
Transmission Control Protocol (TCP) Flow Control
Size: 1.05 MB
Language: en
Added: May 13, 2015
Slides: 33 pages
Slide Content
Presented By Anurag Jagetiya Astt . Prof. MLV Textile & Engineering College, Bhilwara Flow Control in TCP Anurag Jagetiya 1 TCP: Flow Control
Introduction Flow Control in TCP Sliding Window Introduction Terminology Flow Control Through Sliding Window Problems with TCP transmission Delay ACK Silly Window Syndrome Solutions to Silly Window Syndrome TCP Error Control Checksum Ack Retransmission References Outline Anurag Jagetiya 2 TCP: Flow Control
Flow Control balances the Sender’s rate (lightly loaded) of sending data with the Receiver’s rate (heavily loaded) of properly receiving data. Otherwise: Receiver will lost the data Sender has to retransmit the data unnecessarily Consume resources Cost increases Performance decreases User Frustration… Introduction Anurag Jagetiya 3 TCP: Flow Control
Sender can not overrun receiver with lots of information. Allows receiver to restrict transmission until it has sufficient buffer space to accommodate more data Flow control in TCP is similar to Data Link layer’s Go Back N and Selective Repeat in following manners: . Flow Control in TCP Data Link Layer Protocol Similarities with TCP Flow Control Go Back N It does not use NAK Selective Repeat Holds out of order segments until missing one arrives Anurag Jagetiya 4 TCP: Flow Control
But, there are differences as well in flow control mechanism of TCP and Data Link layer TCP uses Sliding Window to handle flow control. Contd … Anurag Jagetiya 5 TCP: Flow Control TCP Flow Control Data Link Flow Control Byte oriented Uses Frames TCP sliding window is of variable size Fixed Size window
Introduction All packets inside the window can be transmitted. When an acknowledgment for packet 1 is received the window slides to the right and allows the transmission of packet 9 Sliding Window in TCP Anurag Jagetiya 6 TCP: Flow Control 1 2 3 4 5 6 7 8 9 10 Window Figure 1: Sliding Window
Conceptually partitions the window into three classes: Sent and acknowledged [left side, out side the window] Being Transmitted [inside the window] Waiting to be transmitted [right side, out side the window] Contd.. Anurag Jagetiya 7 TCP: Flow Control Figure 2: Sliding Window Representation
Only unacknowledged packets are retransmitted TCP keeps separate timer for each packet. Performance: Depends on the window size and the speed of the underlying network. Increase window size so that sender is transmitting packets as fast as the network can carry them. Eliminates network idle time. Contd … Anurag Jagetiya 8 TCP: Flow Control
Terminology used in Sliding Window: Imaginary window with two walls: Left and right The window can perform three activities namely: Opening, Closing, and Shrinking Contd … Anurag Jagetiya 9 TCP: Flow Control NOTE: These activities are controlled by the Receiver and depend on the congestion in the Network Figure 3: Sliding Window terminology
Opening a window Moving the right wall to the right Allows more new bytes in the buffer that are eligible for sending Closing a window Moving left wall to right Some bytes have been acknowledged Shrinking a window Moving right wall to left. Removing eligibility of some packets. [Warning: Strongly discouraged and not allowed in some implementation ] Contd… Anurag Jagetiya 10 TCP: Flow Control NOTE: Left wall cannot move to left, as this will revoke some of previously sent Acknowledges (ACKs)
Sliding window takes the help of two other windows namely: Receiver window (rwnd) Congestion window (cwnd) Receiver window ( rwnd ) Value advertised by the opposite end in a segment containing ACK. It is number of Bytes which can be accepted by the other end before its buffer overflows. Contd … Anurag Jagetiya 11 TCP: Flow Control
Congestion window ( cwnd ) Value determined by the Network (MTU) to avoid congestion. The size of sliding window at one end is determined by the lesser of two values: i.e. Window_Size = Min (rwnd, cwnd) TCP window can be open/ close by the receiver. But should not shrunk. Contd … Anurag Jagetiya 12 TCP: Flow Control
Each window can vary in size over time Each ACK contains a window advisement Specifies how many additional Bytes of data the receiver is willing to accept Sender increases or decreases sending window sized based on the receiver’s advise Provides end-to-end flow control while Data link layer provides Flow Control through Sliding Window Anurag Jagetiya 13 TCP: Flow Control NOTE: In reality the window size is thousands of Bytes
Example of Flow Control Anurag Jagetiya 14 TCP: Flow Control In this example, It is assumed that there is only unidirectional communication between client and server Figure 4: Flow Control [1]
Sender will send the data based upon Receiver’s Advertized Window Size (Free space in Buffer) If, this Window is Zero, sender will not send data. And, what if Receiver’s advertisements are getting lost??------------- Deadlock Sender may send a One byte segment to make the receiver re-announce its next byte expected and window size Problems with TCP Transmission Anurag Jagetiya 15 TCP: Flow Control
Sending data in very small segments. E.g. Telnet connection to an interactive editor that reacts to every key-stroke Worst Case: When a single character is arrived at TCP, TCP creates a 21 Bytes segment and further, IP creates 41 Bytes Datagram….. Receiver, on the other hand, acknowledge by 40 Bytes ACK. -------------------- Wastage of scarce Band width Solution: Delay Acknowledgement and window advertisement Contd … Anurag Jagetiya 16 TCP: Flow Control
The receiver waits until there is decent amount of space in its incoming buffer before acknowledging the arrived segments The delayed acknowledgement can be piggyback on the returning data Reduces traffic Disadvantage: it may force the sender to retransmit the unacknowledged segments To balance: should not be delayed by more than 500 ms Delayed Acknowledgement Anurag Jagetiya 17 TCP: Flow Control
Sending application program creates data slowly or the receiving application program consumes data slowly, or both. (e.g. 1 byte at a time) Server application asks client to create data slowly if it goes continue, window size goes smaller and smaller. At a time, it becomes smaller than its header size, Making data transmission extremely inefficient. Silly Window Syndrome Anurag Jagetiya 18 TCP: Flow Control
In the given figure: The receiving TCP announces a window size of 1 byte. The sending TCP sends only 1 byte. Contd … Anurag Jagetiya 19 TCP: Flow Control Figure 5: Receiver’s Silly Window [2]
Clark’s Solution: For receiving application Do not send a window update of 1 byte until there is enough space to accommodate a segment of max. size or until half of the buffer is empty. Nagle’s Solution: For sending application When data come into sender one byte at a time. Send first byte and buffer all the rest until the outgoing byte is acknowledged. Solution to Silly Window Syndrome Anurag Jagetiya 20 TCP: Flow Control GOAL: Sender should not send small segment and the receiver not ask for them
Alternative method Receiving TCP will buffer data, and it can BLOCK a READ request from application until it has large chunk of data. This will reduce number of calls to TCP and Overhead. Trade-Off: Response time will also increase Acceptable in Non-Interactive applications like: file transfer. Anurag Jagetiya 21 TCP: Flow Control
NET-SEAL [Teaching Computer NET work Through S imulation E xperiment and A nimation L ibrary] Simulation of TCP Flow Control Anurag Jagetiya 22 TCP: Flow Control
TCP is reliable so it will deliver entire stream to the destination without error/ loss/ duplicity. TCP error control provides mechanism for detecting corrupted/ lost/ out of order and duplicate segment. Error detection and correction in TCP is achieved through: Checksum Acknowledgement (ACK) Time out Error Control in TCP Anurag Jagetiya 23 TCP: Flow Control
Checksum is used to find out whether the segments are corrupted or not. TCP uses 16 bit checksum: Mandatory in every segment. E.g. 8 bit checksum Checksum Anurag Jagetiya 24 TCP: Flow Control Calculating Checksum Verifying Checksum Sum Checksum 10101001 00111001 ----------- 11100010 00011101 Sum Complement 10101001 00111001 00011101 ----------- 11111111 0000000
TCP uses ACK to confirm receipt of data segments. Control segments that carry no data but consume a sequence number are also Acknowledged. An ACK do not consume sequence number and it is never Acknowledged. Acknowledgement (ACK) Anurag Jagetiya 25 TCP: Flow Control
When a segment is corrupted, lost, or delayed, it is retransmitted. TCP maintains a Retransmission Timer for each connection The timer is started during a transmission. A timeout causes a retransmission . Retransmission Anurag Jagetiya 26 TCP: Flow Control Q: How to set this time out value for the Retransmission Timer?
Round Trip Time measurement The RTT is based on time difference between segment transmission and ACK. But, TCP does not ACK each segment Each connection has only one timer. Retransmission ( Contd …) Anurag Jagetiya 27 TCP: Flow Control Figure 6: RTT [1]
The setting of the retransmission timer is crucial for efficiency Timeout value too small Results in unnecessary retransmissions Timeout value too large long waiting time before a retransmission can be issued A problem is that the delays in the network are not fixed. Therefore, the retransmission timers must be Dynamic. Retransmission ( Contd …) Anurag Jagetiya 28 TCP: Flow Control
Retransmission Time Out (RTO) If the timer of any segment is expired, that segment is simply re sent to the destination Fast Retransmission: If Retransmission time is large, one segment is lost and receiver received so many out of order segments Store out of order segments in buffer Worse Case: Limited Buffer Size Remedy: Three duplicate ACKs rule Retransmission ( Contd …) Anurag Jagetiya 29 TCP: Flow Control
If three or more duplicate ACKs are received in a row, the TCP sender believes that a segment has been lost. Then TCP performs a retransmission of what seems to be the missing segment, without waiting for a timeout to happen. Fast Retransmission ( 3 ACK Rule) Anurag Jagetiya 30 TCP: Flow Control
Example of Fast Retransmission Anurag Jagetiya 31 TCP: Flow Control Figure 7: 3 ACK [1]
Behrouz A Forouzan , “Transport Layer”, in Data Communication and Networking, 4 th Edition, Tata McGraw Hill, Special Indian Edition, 2006. Andrew S. Tanenbaum , “The Transport Layer”, in Computer Network, 4 th Edition, Prentice Hall India, 2005 www.Net-seal.net References Anurag Jagetiya 32 TCP: Flow Control
Anurag Jagetiya 33 TCP: Flow Control Queries… Thank you…