Tcp Reliability Flow Control


Published on

Unit 4 Of ACN

Published in: Technology
1 Comment
1 Like
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Tcp Reliability Flow Control

  1. 1. TCP requirements <ul><li>Two key requirements of the protocol: </li></ul><ul><ul><li>Reliability: Ensuring that data that is sent actually arrives at its destination, and if not, detecting this and re-sending the data. </li></ul></ul><ul><ul><li>Data Flow Control: Managing the rate at which data is sent so that it does not overwhelm the device that is receiving it. </li></ul></ul>
  2. 2. PAR <ul><li>Reliability in communications follow a rule </li></ul><ul><ul><li>a device to send back an acknowledgment each time it successfully receives a transmission </li></ul></ul><ul><li>If a transmission is not acknowledged after a period of time, it is retransmitted by its sender </li></ul><ul><li>This system is called positive acknowledgment with retransmission (PAR) </li></ul><ul><li>One drawback: the transmitter cannot send next message until the previous is acknowledged. </li></ul>
  3. 3. PAR
  4. 4. TCP sliding window <ul><li>A variation on the enhanced PAR system </li></ul><ul><li>To support TCP’s stream orientation </li></ul><ul><li>Each device keeps track of the status of the byte stream </li></ul><ul><li>Dividing Data into four conceptual categories: </li></ul><ul><ul><li>Bytes sent and acknowledged </li></ul></ul><ul><ul><li>Bytes sent but not yet acknowledged </li></ul></ul><ul><ul><li>Bytes not yet sent but that can be sent immediately </li></ul></ul><ul><ul><li>Bytes not yet sent that cannot be sent until the recipient signals that it is ready for them. </li></ul></ul>
  5. 5. Data Stream categories
  6. 6. Send, usable windows <ul><li>The send window is the key to the entire TCP sliding window system: </li></ul><ul><ul><li>it represents the maximum number of unacknowledged bytes a device is allowed to have outstanding at once. </li></ul></ul><ul><li>The usable window is the amount of the send window that the sender is still allowed to send at any point in time; </li></ul><ul><ul><li>it is equal to the size of the send window less the number of unacknowledged bytes already transmitted. </li></ul></ul>
  7. 7. Send and usable window
  8. 8. Send and usable window
  9. 9. Implementing sliding window <ul><li>Three essential fields in the TCP segment </li></ul><ul><ul><li>The Sequence Number field indicates the number of the first byte of data being transmitted. </li></ul></ul><ul><ul><li>The Acknowledgment Number is used to acknowledge data received by the device sending this segment. </li></ul></ul><ul><ul><li>The Window field tells the recipient of the segment the size to which it should set its send window </li></ul></ul>
  10. 10. Window slide <ul><li>When a device gets an acknowledgment for a range of bytes, it knows they have been successfully received by their destination. </li></ul><ul><li>It moves them from the “sent but unacknowledged” to the “sent and acknowledged” category. </li></ul><ul><li>This causes the send window to slide to the right, allowing the device to send more data. </li></ul>
  11. 11. TCP window size management <ul><li>The receiver on receipt of segment must </li></ul><ul><ul><li>Send Acknowledgement </li></ul></ul><ul><ul><li>Transfer data from buffer to application </li></ul></ul><ul><li>Receiver delay in transfer can happen </li></ul><ul><li>Danger of buffer overflow </li></ul><ul><li>Varying window size to manage data flow </li></ul>
  12. 12. Flow control <ul><li>The TCP sliding window system is used not just for ensuring reliability through acknowledgments and retransmission </li></ul><ul><li>it is also the basis for TCP’s flow control mechanism. </li></ul><ul><li>By increasing or reducing the size of its receive window </li></ul><ul><ul><li>a device can raise or lower the rate at which its connection partner sends it data. </li></ul></ul><ul><ul><li>In the case where a device becomes extremely busy, it can even reduce the receive window to zero, closing it </li></ul></ul><ul><ul><li>this will halt any further transmissions of data until the window is reopened </li></ul></ul>
  13. 13. Shrinking window
  14. 14. Silly window syndrome <ul><li>Sliding window mechanism does not ensure a min size of segment </li></ul><ul><li>Shrinking window can result in inefficient transmission of small size segment </li></ul>
  15. 15. Silly window syndrome
  16. 16. SWS avoidance algorithm <ul><li>Receiver SWS avoidance </li></ul><ul><ul><li>Restrict moving right edge of window by too small amount </li></ul></ul><ul><ul><li>Reduce window size to 0 </li></ul></ul><ul><ul><li>Right edge be moved by half buffer size or MSS whichever is less </li></ul></ul>
  17. 17. Sender SWS avoidance algorithm <ul><li>Nagle’s algorithm – John Nagle </li></ul><ul><ul><li>Data can be immediately sent as long as all sent data is acknowledged </li></ul></ul><ul><ul><li>When there is unacknowledged data </li></ul></ul><ul><ul><ul><li>Do not send till all data acknowledged </li></ul></ul></ul><ul><ul><ul><li>Send after accumulating data for full segment </li></ul></ul></ul>
  18. 18. TCP ACK & Retransmission <ul><li>TCP acknowledgments are cumulative </li></ul><ul><li>Tell a transmitter that all the bytes up to the sequence number indicated in the acknowledgment were received successfully. </li></ul><ul><li>If bytes are received out of order, they cannot be acknowledged until all the preceding bytes are received. </li></ul><ul><li>TCP includes a method for timing transmissions and retransmitting lost segments if necessary. </li></ul>
  19. 19. Managing Retransmissions <ul><li>Each time a segment is sent, a copy is Placed On Retransmission Queue </li></ul><ul><li>Timer Starts at a predetermined value </li></ul><ul><li>Counts down over time </li></ul><ul><li>If an acknowledgment is received for a segment before its timer expires, the segment is removed from the retransmission queue </li></ul><ul><li>If the timer expires before an acknowledgment is received, the segment is retransmitted </li></ul><ul><li>No guarantee that a retransmitted segment will be received </li></ul><ul><li>If not, Retransmission timer is reset, the segment will be retransmitted again and the process repeated </li></ul>
  20. 20. Policies For Dealing with Retransmission <ul><li>Retransmit Only Timed-Out Segments </li></ul><ul><li>Retransmit All Outstanding Segments </li></ul><ul><li>TCP selective acknowledgment </li></ul>
  21. 21. Retransmission Time <ul><li>Length of time for retransmission timer is very important </li></ul><ul><li>If it is set too low </li></ul><ul><ul><li>A segment actually received might be retransmitted </li></ul></ul><ul><ul><li>didn't wait long enough for the acknowledgment </li></ul></ul><ul><li>if it is set too long </li></ul><ul><ul><li>waste time waiting for an acknowledgment that will never arrive </li></ul></ul><ul><ul><li>reducing overall performance </li></ul></ul>
  22. 22. Choosing Retransmission time <ul><li>Ideally, the retransmission timer should be of value just slightly larger than the round-trip time (RTT) </li></ul><ul><li>How to determine RTT? </li></ul><ul><ul><li>Differences in TCP Connection Distances. </li></ul></ul><ul><ul><li>Transient Delays and Variability : The amount of time it takes to send data between any two devices will vary over time due to various happenings on the internetwork: fluctuations in traffic, router loads and so on. </li></ul></ul>
  23. 23. Adaptive Retransmission Based RTT <ul><li>TCP uses a dynamic, or adaptive retransmission scheme </li></ul><ul><li>Average RTT value for the connection </li></ul><ul><li>A smoothing formula: </li></ul><ul><ul><li>New RTT = (a * Old RTT) + ( (1-a) * Newest RTT Measurement); 0 < a < 1 </li></ul></ul><ul><ul><li>a ~ 1 -> better smoothing, slow reaction </li></ul></ul><ul><ul><li>a ~ 0 -> fast reaction </li></ul></ul>
  24. 24. RTT Calculation by Karn's Algorithm <ul><li>Karn's algorithm- Inventor, Phil Karn </li></ul><ul><ul><li>Does not use measured round-trip times </li></ul></ul><ul><ul><li>Eliminates problem of acknowledgment ambiguity </li></ul></ul><ul><li>Start by setting the timer, based on the current average round-trip time </li></ul><ul><li>On retransmission, the timer is not reset to the same value but is “backed off” (increased) using a multiplier (typically 2) to give the retransmission more time to be received </li></ul><ul><li>The timer continues to be increased until a retransmission is successful, up to a certain maximum value </li></ul>
  25. 25. RTT Calculation by Karn's Algorithm <ul><li>The round-trip timer is kept at the longer (backed-off) value until a valid round-trip time can be measured on a segment that is sent and acknowledged without retransmission </li></ul><ul><li>This permits a device to respond with longer timers temporarily, while eventually having the round-trip time settle back to a long-term average when normal conditions resume </li></ul>