Presentation on theme: "LOGO Transmission Control Protocol 12 (TCP) Data Flow."— Presentation transcript:
LOGO Transmission Control Protocol 12 (TCP) Data Flow
In this Chapter 12 Index Summary Basic TCP Data Flow Behavior TCP Acknowledgments TCP Sliding Windows Small Segments Sender-Side Flow Control
Basic TCP Data Flow Behavior - Acknowledgment - Sliding send and receive windows - Avoidance of small segments - Sender-side flow control
TCP Acknowledgments Delayed Acknowledgments Cumulative for Contiguous Data Selective for Noncontiguous Data
If, during the delay, additional TCP segments are received, a single ACK segment can acknowledge the receipt of multiple TCP segments. For full-duplex data flow, delaying the ACK makes it possible for the ACK segment to contain data. This is known as piggybacking the data on the ACK, or piggyback ACKs. If the incoming TCP segment contains data that requires a response from the receiver, the response can be sent along with the ACK. This is common for Telnet traffic, in which each keystroke of the Telnet client is sent to the Telnet server process. The received Telnet keystroke must be echoed back to the Telnet client. Rather than sending an ACK for the keystroke received and then sending the echoed keystroke, a single TCP segment containing the ACK and the echoed keystroke is sent. TCP has the time to perform general connection maintenance. The Application Layer protocol has additional time to retrieve data from TCP, and an updated window size can be sent with ACK. TCP Acknowledgments Delayed Acknowledgments
TCP Acknowledgments Cumulative for Contiguous Data As originally defined in RFC 793, the TCP acknowledgment scheme is cumulative. The presence of the ACK flag and the value of the Acknowledgment Number field explicitly acknowledge all bytes in the received byte stream numbered from the Initial Sequence Number (ISN) + 1 (the first byte of data sent on the connection), up to but not including the number in the Acknowledgment Number field (Acknowledgment Number – 1). Figure 12-1 illustrates the cumulative acknowledgment scheme of TCP.
TCP Acknowledgments Selective for Noncontiguous Data With selective acknowledgments, the Acknowledgment Number field still indicates the number of the last contiguous byte received, but the TCP SACK option can acknowledge noncontiguous received segments. With the TCP SACK option, the left and right edges of the blocks of noncontiguous data received are explicitly acknowledged, preventing needless retransmission. Figure 12-2 illustrates TCPs selective acknowledgment scheme..
TCP Sliding Windows Sent/ACKed Data Sent/UnACKed Data Unsent/Inside Data Unsent/Outside Sliding the Send Window Zero Send Window Send Window
TCP Sliding Windows Receive Window Rcvd/ACKed/Retr Data Rcvd/ACKed/NotRetr Data Rcvd/UnACKed Data NotRcvd/Inside Data NotRcvd/Outside Data Sliding the Receive Window Shrinking the Window
TCP Sliding Windows For optimal throughput, a sender should send enough packets to fill the logical pipe to the receiver. The capacity of this logical pipe can be calculated by multiplying the path bandwidth in bits per second by the round-trip time (RTT) in seconds. This capacity calculation is known as the bandwidth-delay product (BDP). The pipe can be fat (higher bandwidth), thin (lowerbandwidth), short (lower RTT), or long (higher RTT). Pipes that are fat and long have the highest BDP. Examples of high BDP transmission paths are those across satellites or enterprise wide area networks (WANs) that include intercontinental optical fiber links Receive Window Auto-Tuning Below 1 megabits per second (Mbps): 8 kilobytes (KB) 1 Mbps to below 100 Mbps: 17 KB 100 Mbps to below 10 gigabits per second (Gbps): 64 KB 10 Gbps or higher: 128 KB
Small Segments A small segment is a TCP segment that is smaller than the MSS. To increase the efficiency of sending data, TCP avoids sending and receiving small segments by using the Nagle algorithm and by avoiding Silly window syndrome.
Small Segments For interactive data, such as the data of a Telnet or Rlogin session, much of the traffic is made up of individual keystrokes sent by the client and echoed by the server. For each keystroke, a single byte of data is sent. This is a network efficiency of 2.5 percent (the number of bytes of data [1 byte] divided by the number of bytes of overhead needed to send the data [40 bytes]). For interactive sessions, such as Telnet, 1. The client application sends the keystroke byte as a small TCP segment with the Push (PSH) flag set. 2. The keystroke TCP segment is passed to the server application, which sends an echo of the keystroke back to the client application (along with an ACK of the keystroke byte) as a small TCP segment with the PSH flag set. 3. The echoed keystroke TCP segment is passed to the client application, which sends an ACK of the echoed keystroke segment. The Nagle Algorithm
Small Segment 1.The sender and receiver are in a zero window state. The sender has sent all the data it can. The receiver has acknowledged all the data in the receive buffer and is waiting for the Application Layer protocol to retrieve the data before it is free to advertise a nonzero window size. 2.The Application Layer protocol retrieves a single byte of data from the receive buffer. The receive window advances by one byte. 3.The receiver sends an ACK with the window size set to 1. 4.The sender, realizing that the value of Acknowledgment Number + Window has increased, advances its send window by one byte. Because the receiver has permitted the sending of a single byte, the sender sends a single byte. Silly Window Syndrome Receiver-Side SWS Avoidance Sender-Side SWS Avoidance
Sender-Side Flow Control 1. The TCP connection establishment process is done in Frames 1 through 3. cwind is set to 2 MSS. 2. Frames 4 and 5 are the two segments corresponding to the current actual send window size of 2 MSS. 3. Frame 6 is an ACK segment for Frames 4 and 5. cwind is set to 4 MSS. 4. Frames 7 through 10 are the four segments corresponding to the current send actual window size of 4 MSS. 5. Frame 11 is an ACK segment for Frames 7 and 8. Frame 12 is an ACK segment for Frames 9 and 10. cwind is set to 8 MSS. 6. Frames 13 through 20 are the eight segments corresponding to the current actual send window size of 8 MSS. Slow Start Algorithm
Sender-Side Flow Control 1. Set ssthresh to half the value of the current send window with a minimum value of 2 MSS. Set cwind to the value of 2 MSS. 2. Set the actual send window to the minimum of the currently advertised receive window and cwind. 3. Send the appropriate number of TCP segments. 4. As ACKs are received, increment cwind. If cwind ssthresh, increment cwind using slow start. If cwind > ssthresh, increment cwind using congestion avoidance. 5. Return to step 2. Congestion Avoidance Algorithm
Sender-Side Flow Control The slow start and congestion avoidance algorithms work well for LAN media speeds and smaller TCP window sizes. However, when you have a TCP connection with a large receive window size and a large BDP (high bandwidth and high delay), such as replicating data between two servers located across a high-speed WAN link with a 100-ms round-trip time, these algorithms do not increase the send window fast enough to fully utilize the bandwidth of the connection. For example, on a 1-Gbps WAN link with a 100-ms round-trip time (RTT), it can take up to an hour for the send window to initially increase to the large window size being advertised by the receiver and to recover when there are lost segments. To better utilize the bandwidth of TCP connections in these situations, TCP in Windows Server 2008 and Windows Vista supports Compound TCP (CTCP). CTCP more aggressively increases the send window for connections with large receive window sizes and large BDPs. CTCP attempts to maximize throughput on these types of connections by monitoring delay variations and losses. CTCP also ensures that its behavior does not negatively impact other TCP connections. Compound TCP
Sender-Side Flow Control Explicit Congestion Notification ECN Example ECN Support in Windows TCP in Windows Server 2008 and Windows Vista supports ECN, but it is disabled by default. To enable ECN support, use the netsh interface tcp set Global ecncapability=enabled command. To disable ECN support, use the netsh interface tcp set Global ecncapability=disabled command.
Sender-Side Flow Control Transmission Control Protocol (TCP) Retransmission and Timeout, describes how TCP typically uses either a retransmission timeout (RTO) or fast retransmit to detect a lost TCP segment. With a retransmission timeout, the RTO timer on a sent segment expires, and the segment is retransmitted. The RTO is typically on the order of seconds. With fast retransmit, when the sender receives three duplicate acknowledgments for a segment, it retransmits the segment before the RTO expires. Fast retransmit is a much faster way of detecting dropped segments. However, because fast retransmit relies on receiving three duplicate ACKs, it might not detect segment losses when the window size is very small or when a large number of segments are lost. Limited Transmit
www.themegallery.com Summary TCP achieves reliable data transfer through the cumulative or selective acknowledgment of TCP segments received. Selective acknowledgments improve TCP performance in high-loss environments or for TCP connections with large window sizes. To provide receiver-side flow control, TCP uses sliding send and receive windows. With each ACK segment, the receiver indicates how much more data can be sent and successfully received. To avoid sending small segments, TCP uses the Nagle algorithm and SWS avoidance. To provide sender-side flow control, TCP uses the slow start and congestion avoidance algorithms. Slow start increases the size of the actual send window by 1 MSS for each ACK segment received or each segment acknowledged. Congestion avoidance increases the size of the actual send window by 1 MSS for each round-trip time. Slow start and congestion avoidance are used to avoid congesting an IP internetwork when sending and retransmitting data. CTCP increases the send window size more rapidly than slow start and congestion avoidance to optimize use of high-BDP connections. ECN attempts to detect a congested network and lower a TCP peers transmission rate before a router begins discarding packets. Limited Transmit allows a TCP peer to send additional segments on a connection to ensure that fast retransmit can successfully detect dropped packets.