The TCP Segment Header TCP header length in 32 bit words, URG-urgent, ACK- ack number is valid, PSH-push, RST-reset connection, SYN-used to establish connection,

Slides:



Advertisements
Similar presentations
Computer Networks NYUS FCSIT Spring 2008 Milos STOLIC, Bs.C. Teaching Assistant
Advertisements

Chapter 6 The Transport Layer.
Transport Layer – TCP (Part2) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Chapter 6-2 The Transport Layer
Flow and Error Control. Flow Control Flow control coordinates the amount of data that can be sent before receiving acknowledgement It is one of the most.
1 TCP - Part II. 2 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information.
Fundamentals of Computer Networks ECE 478/578 Lecture #21: TCP Window Mechanism Instructor: Loukas Lazos Dept of Electrical and Computer Engineering University.
School of Information Technologies TCP Congestion Control NETS3303/3603 Week 9.
Transport Layer 3-1 Fast Retransmit r time-out period often relatively long: m long delay before resending lost packet r detect lost segments via duplicate.
CMPE 150 – Winter 2009 Lecture 17 March 5, 2009 P.E. Mantey.
The Transport Layer Chapter 6. The TCP Segment Header TCP Header.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
1 Spring Semester 2007, Dept. of Computer Science, Technion Internet Networking recitation #7 TCP New Reno Vs. Reno.
1 Internet Networking Spring 2002 Tutorial 10 TCP NewReno.
The Transport Layer Chapter 6. Performance Issues Performance Problems in Computer Networks Network Performance Measurement System Design for Better Performance.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
The Transport Layer Chapter 6. The Transport Service Services Provided to the Upper Layers Transport Service Primitives Berkeley Sockets An Example of.
1 Internet Networking Spring 2004 Tutorial 10 TCP NewReno.
Computer Networks Transport Layer. Topics F Introduction  F Connection Issues F TCP.
1 K. Salah Module 6.1: TCP Flow and Congestion Control Connection establishment & Termination Flow Control Congestion Control QoS.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
TCP: flow and congestion control. Flow Control Flow Control is a technique for speed-matching of transmitter and receiver. Flow control ensures that a.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Transport Layer Chapter 6.
Copyright © Lopamudra Roychoudhuri
3: Transport Layer3b-1 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection m MSS: maximum.
1 Transport Protocols (continued) Relates to Lab 5. UDP and TCP.
The Transport Layer.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
Chapter 12 Transmission Control Protocol (TCP)
Malathi Veeraraghavan Originals by Jörg Liebeherr 1 Error Control Congestion Control Timers.
Copyright 2008 Kenneth M. Chipps Ph.D. Controlling Flow Last Update
(from Tanenabaum: “Computer Networks” Chapter 1) and
Copyright © Lopamudra Roychoudhuri
1 TCP - Part II Relates to Lab 5. This is an extended module that covers TCP data transport, and flow control, congestion control, and error control in.
Lecture 9 – More TCP & Congestion Control
The Transport Layer Chapter 6 12/14/2015www.ishuchita.com1.
CS640: Introduction to Computer Networks Aditya Akella Lecture 15 TCP – III Reliability and Implementation Issues.
Computer Networking Lecture 18 – More TCP & Congestion Control.
Lab The network simulator ns The network simulator ns Allows us to watch evolution of parameters like cwnd and ssthresh Allows us to watch evolution of.
TCP: Transmission Control Protocol Part II : Protocol Mechanisms Computer Network System Sirak Kaewjamnong Semester 1st, 2004.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
1 TCP Timeout And Retransmission Chapter 21 TCP sets a timeout when it sends data and if data is not acknowledged before timeout expires it retransmits.
1 TCP - Part II. 2 What is Flow/Congestion/Error Control ? Flow Control: Algorithms to prevent that the sender overruns the receiver with information.
The Transport Layer Chapter Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall,
ECE 4110 – Internetwork Programming
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP data transport, and flow control, congestion control, and error control in TCP.
TCP Timeout and Retransmission
TCP Congestion Control 컴퓨터공학과 인공지능 연구실 서 영우. TCP congestion control2 Contents 1. Introduction 2. Slow-start 3. Congestion avoidance 4. Fast retransmit.
TCP continued. Discussion – TCP Throughput TCP will most likely generate the saw tooth type of traffic. – A rough estimate is that the congestion window.
Chapter 6 Transport Layer
Fall 2004FSU CIS 5930 Internet Protocols1 TCP – Data Exchange Reading: Section 24.4.
4343 X2 – The Transport Layer Tanenbaum Ch.6.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Transmission Control Protocol (TCP) TCP Flow Control and Congestion Control CS 60008: Internet Architecture and Protocols Department of CSE, IIT Kharagpur.
The Transport Layer Dr. ir. S.S. Msanjila RIS 251.
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
TCP over Wireless PROF. MICHAEL TSAI 2016/6/3. TCP Congestion Control (TCP Tahoe) Only ACK correctly received packets Congestion Window Size: Maximum.
TCP - Part II.
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
Unit-7 The Transport Layer.
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 full duplex data:
Chapter 6 The Transport Layer.
The Transport Layer Chapter
Transport Layer Unit 5.
Chapter 5 TCP Transmission Control
TCP - Part II Relates to Lab 5. This is an extended module that covers TCP flow control, congestion control, and error control in TCP.
CS4470 Computer Networking Protocols
The Transport Layer Chapter 6.
TCP: Transmission Control Protocol Part II : Protocol Mechanisms
Presentation transcript:

The TCP Segment Header TCP header length in 32 bit words, URG-urgent, ACK- ack number is valid, PSH-push, RST-reset connection, SYN-used to establish connection, FIN-used to release connection

The TCP Segment Header (2) The pseudoheader (part of the IP header) included in the TCP checksum.

TCP Options Some TCP options are: Maximum segment size (MSS): Specified what is the payload the sender is able to receive. (Default MSS = 536 bytes, i.e., Segment size = MSS + 20). SMSS/RMSS is Sender/Receiver MSS. Window scale: The window size field allows for upto 2^16 bytes of data. But this might be inefficient for high bw x delay situations. This options TCP indicate a scaling factor. Negative acknowledgement: Lets receiver user NAKs to get realize selective repeat rather than the normal go-back-N TCP behaviour.

TCP Connection Establishment (a) TCP connection establishment in the normal case. (b) Call collision Initial sequence numbers are not 0. TCP uses a clock tick counter (at 4 usecs rate) to setup the initial sequence numbers. This scheme prevents delayed duplicates.

TCP Connection Establishment Each side releases the connection independently. If A send a FIN to B and B ACKs that FIN. It only means no data will flow from A to B. Data can still flow from B to A indefinitely. In all 4 messages are required to completely release the connection. A FIN and ACK for each side. However, the second FIN and the first ACK can be combined for 3 messages. TCP avoids the Two-Army problem in connection release using timers. If the FIN is not ACKed within within a fixed time, the connection is released.

TCP Connection Management Modeling The states used in the TCP connection management finite state machine.

TCP Connection Management Modeling (2) TCP connection management finite state machine. The heavy solid line is the normal path for a client. The heavy dashed line is the normal path for a server. The light lines are unusual events. Each transition is labeled by the event causing it and the action resulting from it, separated by a slash.

TCP Transmission Policy Window Management in TCP

Sender Receiver The senders application performs a 2K write to the receivers buffer, which is now half full. SEQ=02K Application does a 2K write Empty 04K 2K

Sender Receiver SEQ=02K ACK=2048 WIN=2048 Application does a 2K write Empty 04K 2K The receiver acknowledges the first 2048 bytes and informs the sender that there is space in the buffer for 2048 bytes.

Sender Receiver SEQ=02K ACK=2048 WIN=2048 Application does a 2K write SEQ=20482K Application does a 2K write Empty 04K Full 2K The sender’s application writes another 2K. The receivers buffer is now full and the sender is blocked.

Sender Receiver SEQ=02K ACK=2048 WIN=2048 SEQ=20482K ACK=4096 WIN=0 Application does a 2K write Sender is blocked Empty 04K Full 2K The receiver acknowledges the next 2048 (total of 4096) bytes and informs the sender that there is no space in the buffer. The sender is still blocked.

Sender Receiver SEQ=02K ACK=2048 WIN=2048 SEQ=20482K ACK=4096 WIN=0 Application does a 2K write { Sender is blocked ACK=4096 WIN=2048 Sender may send up to 2K Empty 04K Full 2K The receiver clears 2048 bytes from the buffer and informs the sender that this space is available for use. The sender is now unblocked and may send 2K.

Sender Receiver SEQ=02K ACK=2048 WIN=2048 SEQ=20482K ACK=4096 WIN=0 ACK=4096 WIN=2048 Application does a 2K write SEQ=40961K Application does a 1K write { Sender is blocked Sender may send up to 2K Empty 04K Full 2K 1K The sender’s application writes another 1K. The receivers buffer now has 1K of space available.

TCP Transmission Policy Window management in TCP.

TCP Transmission Policy Sender TCP is not required to send data as soon as it arrives from the application. Sender TCP might buffer to create larger segments (up to receiver window size) Receiver TCP is not required to send ACK as soon as receives a segment. Receiver might delay ACK for up to 500 msecs hoping to piggyback ACK on data from receiver to sender. Such ACKS are called delayed ACKs

TCP Transmission Policy Silly window syndrome.

Nagle's algorithm Purpose is to allow the sender TCP to make efficient use of the network, while still being responsive to the sender applications. Idea: If application data comes in byte by byte, send first byte only. Then buffer all application data till until ACK for first byte comes in. If network is slow and application is fast, the second segment will contain a lot of data. Send second segment and buffer all data till ACK for second segment comes in. This way the algorithm is clocking the sends to speed of the network and simultaneously preventing sending several one byte segments back to back. An exception to this rule is to always send (not wait for ACK) if enough data for half the receiver window or MSS.

TCP congestion control We looked at how TCP handles flow control. In addition we know the congestion happens. The only real way to handle congestion is for the sender to reduce sending rate. So how does on detect congestion ? In old days, packets were lost due to transmission errors and congestion. But nowadays, transmission errors are very rare (except for wireless). So, TCP assumes a lost packet as an indicator of congestion. So does TCP deal with congestion ? It maintains an indicator of network capacity, called the congestion window

TCP Congestion Control (a) A fast network feeding a low capacity receiver. (b) A slow network feeding a high-capacity receiver.

TCP congestion control In essence TCP deals with two potential problems separately: ProblemSolution Receiver capacityReceiver window (rwnd) Network capacityCongestion window (cwnd) Each window reflect the number of bytes the sender may transmit. The sender sends the minimum of these two sizes. This size is the effective window. Effective window is the minimum of what the sender thinks is all right to send (congestion window) and what the receiver this is ok to send (receiver window). We assume that both rwnd and cwnd are measured in bytes (an alternative is SMSS).

TCP Congestion Control – 4 Stages TCP uses these stages in updating cwnd. 1. Slow start: Initial state. Rapidly grow cwnd 2. Congestion avoidance: Slowly grow cwnd. 3. Fast retransmit: Retransmit without waiting for timeout. 4. Fast recovery: Don't reset cwnd. } Control amount of data injected into network READING: TCP Congestion Control RFC

TCP Congestion Control – Slow start This is the initial state or state after loss of data. cwnd grows by multiples of SMSS per ACK Initial window (IW) is 1 SMSS. So after the ACK comes in cwnd becomes 2 SMSS. Then after the 2 ACKs come in the cwnd grows to 4 SMSS and so on. So growth is in fact exponential. After data loss cwnd is set to the Loss Window (LW) size of 1 SMSS. Slow start threshold (ssthresh) is used to change from slow start to congestion avoidance. If cwnd < ssthesh, slow start else congestion avoidance. Initial ssthresh is usually set to rwnd.

TCP Congestion Control – Congestion Avoidance This stage follows slow start after cwnd > ssthresh cwnd grows by 1 SMSS per RTT. This stage continues until congestion is detected. For every non-duplicate ACK update cwnd using: cwnd += SMSS * (SMSS/cwnd) Assuming cwnd bytes are sent in a burst in full SMSS segments, after an interval of RTT after the burst (cwnd/SMMS) ACKs will be received. So the total cwnd will increase by SMSS * (SMSS/cwnd) * (cwnd/SMSS), which is simply SMMS. Hence using the above updating formula cwnd will increase by 1 SMSS per RTT.

TCP congestion control – Adjusting ssthresh When TCP detects a loss, cwnd falls to LW (1 SMSS). Also the ssthresh is adjusted using: ssthresh = max (FlightSize / 2, 2*SMSS) FlightSize is the number of unacked bytes (bytes still on the wire). In most cases cwnd is equal to FlightSize.

TCP Congestion Control An example of the Internet congestion algorithm.

TCP congestion control – Fast Retransmit and Fast Recovery TCP receiver should send duplicate ACK when out-of-order segment arrives. A duplicate ACK at sender could mean: 1. Lost segment (all subsequent segments will generate duplicate ACKs) 2. Re-ordered segments. 3. Network replicated ACK or data segment. Fast retransmit algo says retransmit segment after getting 3 duplicate acks, without waiting for RTO (Retransmit Timeout) to expire. Fast recovery says don't treat the above retransmit as a lost segment (since RTO did not expire), so don't reset cwnd to LW. The reasoning is that since (duplicate) ACKs are arriving, the receiver is getting segments, so segments are leaving the network. In fast recovery, adjust ssthresh using previous formula.

TCP Timer Management Of the several timers TCP maintains the most important is the retransmission timer RTO, (also called timeout). After each segment is sent, TCP starts a retransmission timer, if ACK arrives before timer expires, cancel timer. If timer expires first, consider segment lost. How long should RTO be ? Typically some small multiple of RTT. So how to measure RTT ? Measure time between segment sent and ACK receiver. Unfortunately, in the Internet RTT are not constant, they a vary a lot.

TCP Timer Management (a) Probability density of ACK arrival times in the data link layer. (b) Probability density of ACK arrival times for TCP.

Maintaining RTO TCP dynamically updates the current RTT and most recent measurement M (how long it took to receive the last ACK) using: However, using a constant multiple of RTT as the RTO is inflexible since it fails to respond to variance. TCP keep an estimator of deviation D. D keeps track of the the variance in RTT, i.e, in RTT – M using: The final retransmission timeout (RTO) is calculated as:

RTO exceptions Assume a segment times out and is then retransmitted. An ACK for the segment arrives. So for purposes for calculating M how do we decide if the ack is for the first send or the retransmission ? We cannot. It might be for the first, but very delayed, or might be for the second. So we cannot use ACKs of retransmitted segments for calculating M (or updating RTT). Rule: Don't use acks of retransmitted segments to update RTT. Instead, if segment times out, simply double RTO. This is called the Karn's algorithm.

Other timers Persistent timer: Assume receiver advertises a window = 0. Sender stop sending. Receiver send segment with new window size. This segment is lost. Sender will keep waiting forever. After getting a window of 0 the sender uses a persistent timer periodically to probe the receiver to send window advertisements. Once it gets a non-zero window the timer is stopped. Keep alive timer: During long periods of inactivity, one side might send to the other a keep alive probe to check if the other side is alive.

Wireless TCP Wireless network can lose packet in wireless “links”. Since TCP assumes loss is due to route congestion, it will reduce sending rate. If the loss due to wireless link, TCP should resend asap, i.e., increase overall sending rate. Therefore, the usual TCP will perform very badly on lossy wireless networks. Problem complicated by heterogeneous networks. If part wired and part wireless, then reaction of TCP should depend on where the loss occurred (wired or wireless part).

Split TCP Splitting a TCP connection into two connections. But now ACK to sender does not mean mobile host got it. It simply means the base station got it. No end-to-end semantics.

Wireless TCP – Balakrishnan et. al Wireless Snooping agent Snooping agent caches segments from fixed to mobile hosts and forwards it to mobile host with small timeout of its own. If agent does not see mobile host's ack, the agent retransmits the segment. If agent sees two duplicates acks from mobile host (indicator of lost segment) it drops the acks (does not forwards to fixed host) and retransmits from cache. Advantage: It is completely transparent to both hosts. Fixed host Mobile host Base station

Transactional TCP (a) Remote Procedure Call (RPC) using normal TPC. (b) RPC using T/TCP.

Performance Issues a)Performance Problems in Computer Networks b)Network Performance Measurement c)System Design for Better Performance d)Fast TPDU Processing

Performance Problems in Computer Networks (a) At t = 0, (b) After 500 μsec, (c) After 20 msec, (d) After 40 msec. Transmitting 1MB from San Diego to Boston Other network performance problem causes: Synchronous overload: Broadcast storm due to bad UDP broadcast Segment. Power loss leading to DHCP/file server overload.

Network Performance Measurement The basic loop for improving network performance. A.Measure relevant network parameters, performance. B.Try to understand what is going on. C.Change one parameter.

Network Performance Measurement Make sure that the sample size is large enough Make sure that he samples are representatives Be careful when using a coarse-grained clock Be sure that nothing unexpected is going on during your tests. Caching can wreak havoc with measurements. Understand what you are measuring. Be careful about extrapolating the results.

System Design for Better Performance Rules: A.CPU speed is more important than network speed. B.Reduce packet count to reduce software overhead. C.Minimize context switches. D.Minimize copying. E.You can buy more bandwidth but not lower delay. F.Avoiding congestion is better than recovering from it. G.Avoid timeouts.

Fast TPDU Processing The fast path from sender to receiver is shown with a heavy line. The processing steps on this path are shaded.

Fast TPDU Processing (2) (a) TCP header. (b) IP header. In both cases, the shaded fields are taken from the prototype without change.

Timing Wheel A timing wheel.