TCP reliable data transfer. Chapter 3 outline. TCP sender events: TCP sender (simplified) TCP: retransmission scenarios. TCP: retransmission scenarios

Similar documents
CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 10

Chapter 3- parte B outline

TCP: Overview RFCs: 793,1122,1323, 2018, 2581

Chapter III: Transport Layer

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

Chapter 3 Transport Layer

Computer Networking Introduction

Chapter 3 Transport Layer

TCP (Part 2) Session 10 INST 346 Technologies, Infrastructure and Architecture

Chapter 3 Transport Layer

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 9

CSC 401 Data and Computer Communications Networks

Chapter III: Transport Layer

Chapter III: Transport Layer

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

Chapter 3 Transport Layer

10 minutes survey (anonymous)

CSC358 Week 5. Adapted from slides by J.F. Kurose and K. W. Ross. All material copyright J.F Kurose and K.W. Ross, All Rights Reserved

Chapter 3 Transport Layer

CNT 6885 Network Review on Transport Layer

CSC 8560 Computer Networks: TCP

CSC 401 Data and Computer Communications Networks

rdt3.0: channels with errors and loss

Chapter 3 Transport Layer

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

CSC 4900 Computer Networks: TCP

Lecture 12: Transport Layer TCP again

Chapter 3 Transport Layer

Computer Networking Introduction

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

Lecture 8. TCP/IP Transport Layer (2)

CC451 Computer Networks

Computer Networking: A Top Down Approach

Chapter 3 Transport Layer

Course on Computer Communication and Networks. Lecture 5 Chapter 3; Transport Layer, Part B

Chapter 3: Transport Layer

Chapter 3: Transport Layer

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581

Lecture 11. Transport Layer (cont d) Transport Layer 1

Pipelined protocols: overview

Mid Term Exam Results

LECTURE 3 - TRANSPORT LAYER

Lecture 15: Transport Layer Congestion Control

Correcting mistakes. TCP: Overview RFCs: 793, 1122, 1323, 2018, TCP seq. # s and ACKs. GBN in action. TCP segment structure

Chapter 3 outline. Chapter 3: Transport Layer. Transport vs. network layer. Transport services and protocols. Internet transport-layer protocols

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, Development of reliable protocol Sliding window protocols

Chapter 3 Transport Layer

Chapter 3 Transport Layer

EC441 Fall 2018 Introduction to Computer Networking Chapter 3: Transport Layer

Chapter 3: Transport Layer

Transport Layer. Chapter 3. Computer Networking: A Top Down Approach

Chapter 3 Transport Layer

Transport Layer. CMPS 4750/6750: Computer Networks

Go-Back-N. Pipelining: increased utilization. Pipelined protocols. GBN: sender extended FSM

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, steam: r Development of reliable protocol r Sliding window protocols

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Architettura di Reti

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Chapter 3: Transport Layer

CSC 4900 Computer Networks: TCP

internet technologies and standards

Chapter 3 Transport Layer

internet technologies and standards

CS/ECE 438: Communication Networks Fall Transport Layer

Chapter 3 Transport Layer

Chapter 3 Transport Layer

CSCD 330 Network Programming Winter 2015

Chapter 3 Transport Layer

32 bits. source port # dest port # sequence number acknowledgement number not used. checksum. Options (variable length)

CSCI Topics: Internet Programming Fall 2008

Transport Layer: outline

Chapter 3: Transport Layer

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

COMP211 Chapter 3 Transport Layer

CSCI Topics: Internet Programming Fall 2008

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

Master Course Computer Networks IN2097

Chapter 3 Transport Layer

Internetworking With TCP/IP

CSE 4/589 Midterm Review. Hengtong Zhang SUNY Buffalo 10/30/2018

Discussions. Chapter 3. Ch03 Transport Layer. Outline. Transport services and protocols. Transport vs. network layer. Message, Segment, Datagram

By Ossi Mokryn, Based also on slides from: the Computer Networking: A Top Down Approach Featuring the Internet by Kurose and Ross

CS 43: Computer Networks. 19: TCP Flow and Congestion Control October 31, Nov 2, 2018

RSC Part III: Transport Layer 3. TCP

Transport Layer: Outline

internet technologies and standards

Lecture 08: The Transport Layer (Part 2) The Transport Layer Protocol (TCP) Dr. Anis Koubaa

Chapter 6 Transport Layer

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Chapter 3: Transport Layer

Computer Communication Networks Midterm Review

CSCI Topics: Internet Programming Fall 2008

Transcription:

Chapter 3 outline TCP reliable 3.2 principles of reliable 3.3 connection-oriented flow 3.4 principles of congestion 3.5 TCP congestion TCP creates rdt service on top of IP s unreliable service pipelined segments cumulative acks single retransmission timer retransmissions triggered by: events duplicate acks let s initially consider simplified TCP sender: ignore duplicate acks ignore flow, congestion Transport Layer 3-1 Transport Layer 3-2 TCP sender events: data rcvd from app: create segment with seq # seq # is byte-stream number of first data byte in segment start timer if not already running think of timer as for oldest unacked segment expiration interval: TimeOutInterval : retransmit segment that caused restart timer ack rcvd: if ack acknowledges previously unacked segments update what is known to be ACKed start timer if there are still unacked segments Transport Layer 3-3 TCP sender (simplified) NextSeqNum = InitialSeqNum SendBase = InitialSeqNum wait for event ACK received, with ACK field value y data received from above create segment, seq. #: NextSeqNum pass segment to IP (i.e., send ) NextSeqNum = NextSeqNum + length(data) if (timer currently not running) start timer if (y > SendBase) { SendBase = y /* SendBase 1: last cumulatively ACKed byte */ if (there are currently not-yet-acked segments) start timer else stop timer } retransmit not-yet-acked segment with smallest seq. # start timer Transport Layer 3-4 TCP: retransmission scenarios TCP: retransmission scenarios SendBase=92 X Seq=100, 20 bytes of data ACK=120 Seq=100, 20 bytes of data X ACK=120 SendBase=100 SendBase=120 Seq=92, 8 bytes of data ACK=120 Seq=120, 15 bytes of data SendBase=120 lost ACK scenario premature cumulative ACK Transport Layer 3-5 Transport Layer 3-6 1

TCP ACK generation [RFC 1122, RFC 2581] TCP fast retransmit event at receiver arrival of in-order segment with expected seq #. All data up to expected seq # already ACKed arrival of in-order segment with expected seq #. One other segment has ACK pending arrival of out-of-order segment higher-than-expect seq. #. Gap detected arrival of segment that partially or completely fills gap TCP receiver action delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK immediately send single cumulative ACK, ACKing both in-order segments immediately send duplicate ACK, indicating seq. # of next expected byte immediate send ACK, provided that segment starts at lower end of gap time-out period often relatively long: long delay before resending lost packet detect lost segments via duplicate ACKs. sender often sends many segments backto-back if segment is lost, there will likely be many duplicate ACKs. TCP fast retransmit if sender receives 3 ACKs for same data ( triple duplicate ACKs ), resend unacked segment with smallest seq # likely that unacked segment lost, so don t wait for Transport Layer 3-7 Transport Layer 3-8 TCP fast retransmit Seq=100, 20 bytes of data X Seq=100, 20 bytes of data Chapter 3 outline 3.2 principles of reliable 3.3 connection-oriented flow 3.4 principles of congestion 3.5 TCP congestion fast retransmit after sender receipt of triple duplicate ACK Transport Layer 3-9 Transport Layer 3-10 TCP flow flow receiver s sender, so sender won t overflow receiver s buffer by transmitting too much, too fast may remove data from TCP socket buffers. slower than TCP receiver is delivering (sender is sending) process TCP socket receiver buffers from sender TCP code IP code receiver protocol stack OS TCP flow receiver advertises free buffer space by including rwnd value in TCP header of receiver-to-sender segments RcvBuffer size set via socket options (typical default is 4096 bytes) many operating systems autoadjust RcvBuffer sender limits amount of unacked ( in-flight ) data to receiver s rwnd value guarantees receive buffer will not overflow to process RcvBuffer buffered data rwnd free buffer space TCP segment payloads receiver-side buffering Transport Layer 3-11 Transport Layer 3-12 2

Chapter 3 outline 3.2 principles of reliable 3.3 connection-oriented flow 3.4 principles of congestion 3.5 TCP congestion Connection Management before exchanging data, sender/receiver handshake : agree to establish connection (each knowing the other willing to establish connection) agree on connection parameters connection state: connection variables: seq # client-to-server server-to-client rcvbuffer size at server,client network connection state: connection Variables: seq # client-to-server server-to-client rcvbuffer size at server,client network Socket clientsocket = newsocket("hostname","port number"); Socket connectionsocket = welcomesocket.accept(); Transport Layer 3-13 Transport Layer 3-14 Agreeing to establish a connection Agreeing to establish a connection 2-way handshake: Let s talk OK choose x acc_conn(x) Q: will 2-way handshake always work in network? variable delays retransmitted messages (e.g. ) due to message loss message reordering can t see other side Transport Layer 3-15 2-way handshake failure scenarios: choose x retransmit client terminates acc_conn(x) connection x completes half open connection! (no client!) server forgets x choose x retransmit retransmit client terminates acc_conn(x) connection x completes accept server forgets x accept Transport Layer 3-16 TCP 3-way handshake TCP 3-way handshake: FSM client state server state closed LISTEN SYNSENT choose init seq num, x send TCP SYN msg received SYNACK(x) indicates server is live; send ACK for SYNACK; this segment may contain client-to-server data SYNbit=1, Seq=x choose init seq num, y send TCP SYNACK msg, acking SYN SYNbit=1, Seq=y ACKbit=1; ACKnum=x+1 ACKbit=1, ACKnum=y+1 received ACK(y) indicates client is live LISTEN SYN RCVD Socket connectionsocket = welcomesocket.accept(); SYN(x) SYNACK(seq=y,ACKnum=x+1) create new socket for communication back to client SYN rcvd ACK(ACKnum=y+1) listen SYN sent Socket clientsocket = newsocket("hostname","port number"); SYN(seq=x) SYNACK(seq=y,ACKnum=x+1) ACK(ACKnum=y+1) Transport Layer 3-17 Transport Layer 3-18 3

TCP: closing a connection client, server each close their side of connection send TCP segment with FIN bit = 1 respond to received FIN with ACK on receiving FIN, ACK can be combined with own FIN simultaneous FIN exchanges can be handled TCP: closing a connection client state FIN_WAIT_1 FIN_WAIT_2 TIMED_WAIT clientsocket.close() can no longer send but can receive data wait for server close timed wait for 2*max segment lifetime FINbit=1, seq=x ACKbit=1; ACKnum=x+1 FINbit=1, seq=y ACKbit=1; ACKnum=y+1 can still send data can no longer send data server state CLOSE_WAIT LAST_ACK CLOSED CLOSED Transport Layer 3-19 Transport Layer 3-20 Quiz #2 Consider the following network. wants to simultaneously send messages to hosts B and C. A is connected to B and C via a broadcast channel a packet sent by A is carried by the channel to both B and C. Suppose that the broadcast channel connecting A, B, and C can independently lose and corrupt messages (and so, for example, a message sent from A might be correctly received by B but not by C). The stop-and-wait-like error- protocol is used for reliably transferring packets from A to B and C, such that A will send a new packet from the upper layer until it knows that both B and C have correctly received the current packet. Packets from upper layers may be queued in a sufficiently large buffer. Give FSM descriptions of A and C. (Hint: The FSM for B should be the same as for C) Quiz #3 Consider the GBN protocol with a sender window size of 4 and sequence number range of 1,024. Suppose that at time t, the next in-order packet that the receiver is expecting has a sequence number of k. Assume that the medium does not reorder message. Answer the following questions: a. What are the possible sets of sequence numbers inside the sender s window at time t? b. What are all possible values of the ACK field in all possible messages currently propagating back to the sender at time t? Transport Layer 3-21 Transport Layer 3-22 Chapter 3 outline Principles of congestion 3.2 principles of reliable 3.3 connection-oriented flow 3.4 principles of congestion 3.5 TCP congestion congestion: informally: too many sources sending too much data too fast for network to handle different from flow! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) a top-10 problem! Transport Layer 3-23 Transport Layer 3-24 4

Causes/costs of congestion: scenario 1 original data: two senders, two receivers one router, infinite buffers output link capacity: R no retransmission unlimited shared output link buffers throughput: one router, finite buffers sender retransmission of timed-out packet -layer input = -layer output: = transport-layer input includes retransmissions : λ in : original data delay maximum per-connection throughput: v large delays as arrival rate,, approaches capacity Transport Layer 3-25 finite shared output link buffers Transport Layer 3-26 idealization: perfect knowledge sender sends only when router buffers available Idealization: known loss packets can be lost, dropped at router due to full buffers sender only resends if packet known to be lost copy : original data copy : original data A free buffer space! A no buffer space! finite shared output link buffers Transport Layer 3-27 Transport Layer 3-28 Idealization: known loss packets can be lost, dropped at router due to full buffers sender only resends if packet known to be lost when sending at, some packets are retransmissions but asymptotic goodput is still (why?) Realistic: duplicates packets can be lost, dropped at router due to full buffers sender times out prematurely, sending two copies, both of which are delivered when sending at, some packets are retransmissions including duplicated that are delivered! : original data copy λ' in A free buffer space! A free buffer space! Transport Layer 3-29 Transport Layer 3-30 5

Realistic: duplicates packets can be lost, dropped at router due to full buffers sender times out prematurely, sending two copies, both of which are delivered when sending at, some packets are retransmissions including duplicated that are delivered! costs of congestion: more work (retrans) for given goodput unneeded retransmissions: link carries multiple copies of pkt decreasing goodput Causes/costs of congestion: scenario 3 four senders multihop paths /retransmit Host D Q: what happens as and λ in increase? A: as red λ in increases, all arriving blue pkts at upper queue are dropped, blue throughput g 0 : original data finite shared output link buffers Host C Transport Layer 3-31 Transport Layer 3-32 Causes/costs of congestion: scenario 3 Chapter 3 outline C/2 C/2 another cost of congestion: when packet dropped, any upstream transmission capacity used for that packet was wasted! 3.2 multiplexing and demultiplexing 3.3 connectionless transport: UDP 3.4 principles of reliable 3.5 connection-oriented flow 3.6 principles of congestion 3.7 TCP congestion Transport Layer 3-33 Transport Layer 3-34 TCP congestion : additive increase multiplicative decrease approach: sender increases transmission rate (window size), probing for usable bandwidth, until loss occurs additive increase: increase cwnd by 1 MSS every RTT until loss detected multiplicative decrease: cut cwnd in half after loss AIMD saw tooth behavior: probing for bandwidth cwnd: TCP sender congestion window size additively increase window size. until loss occurs (then cut window in half) time Transport Layer 3-35 TCP Congestion Control: details sender sequence number space cwnd last byte ACKed sent, notyet ACKed ( inflight ) last byte sent sender limits transmission: LastByteSent- LastByteAcked < cwnd cwnd is dynamic, function of perceived network congestion TCP sending rate: roughly: send cwnd bytes, wait RTT for ACKS, then send more bytes rate ~ cwnd bytes/sec RTT Transport Layer 3-36 6

TCP Slow Start when connection begins, increase rate exponentially until first loss event: initially cwnd = 1 MSS double cwnd every RTT done by incrementing cwnd for every ACK received summary: initial rate is slow but ramps up exponentially fast RTT one segment two segments four segments time TCP: detecting, reacting to loss loss indicated by : cwnd set to 1 MSS; window then grows exponentially (as in slow start) to threshold, then grows linearly loss indicated by 3 duplicate ACKs: TCP RENO dup ACKs indicate network capable of delivering some segments cwnd is cut in half window then grows linearly TCP Tahoe always sets cwnd to 1 ( or 3 duplicate acks) Transport Layer 3-37 Transport Layer 3-38 TCP: switching from slow start to CA Q: when should the exponential increase switch to linear? A: when cwnd gets to 1/2 of its value before. Implementation: variable ssthresh on loss event, ssthresh is set to 1/2 of cwnd just before loss event Summary: TCP Congestion Control dupackcount == 3 ssthresh= cwnd/2 cwnd = ssthresh + 3 ssthresh = cwnd/2 cwnd = 1 MSS cwnd = cwnd + MSS transmit new segment(s), as allowed * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ Transport Layer 3-39 Transport Layer 3-40 cwnd = 1 MSS ssthresh = 64 KB ssthresh = cwnd/2 cwnd = 1 MSS duplicate ACK dupackcount++ slow start New ACK! new ACK cwnd = cwnd+mss transmit new segment(s), as allowed cwnd > ssthresh ssthresh = cwnd/2 cwnd = 1 fast recovery duplicate ACK New ACK! new ACK cwnd = cwnd + MSS. (MSS/cwnd) transmit new segment(s), as allowed congestion avoidance New ACK! New ACK cwnd = ssthresh duplicate ACK dupackcount++ dupackcount == 3 ssthresh= cwnd/2 cwnd = ssthresh + 3 TCP throughput avg. TCP thruput as function of window size, RTT? ignore slow start, assume always data to send W: window size (measured in bytes) where loss occurs avg. window size (# in-flight bytes) is ¾ W avg. thruput is 3/4W per RTT W W/2 avg TCP thruput = 3 W 4 RTT bytes/sec TCP Futures: TCP over long, fat pipes example: 1500 byte segments, 100ms RTT, want 10 Gbps throughput requires W = 83,333 in-flight segments throughput in terms of segment loss probability, L [Mathis 1997]: TCP throughput = 1.22. MSS RTT L to achieve 10 Gbps throughput, need a loss rate of L = 2 10-10 a very small loss rate! new versions of TCP for high-speed Transport Layer 3-41 Transport Layer 3-42 7

TCP Fairness fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K Why is TCP fair? two competing sessions: additive increase gives slope of 1, as throughout increases multiplicative decrease decreases throughput proportionally TCP connection 1 TCP connection 2 bottleneck router capacity R R Connection 2 throughput Connection 1 throughput equal bandwidth share loss: decrease window by factor of 2 congestion avoidance: additive increase loss: decrease window by factor of 2 congestion avoidance: additive increase R Transport Layer 3-43 Transport Layer 3-44 Fairness (more) Fairness and UDP multimedia apps often do not use TCP do not want rate throttled by congestion instead use UDP: send audio/video at constant rate, tolerate packet loss Fairness, parallel TCP connections can open multiple parallel connections between two hosts web browsers do this e.g., link of rate R with 9 existing connections: new app asks for 1 TCP, gets rate R/10 new app asks for 11 TCPs, gets Transport Layer 3-45 Explicit Congestion Notification (ECN) network-assisted congestion : two bits in IP header (ToS field) marked by network router to indicate congestion congestion indication carried to receiving host receiver (seeing congestion indication in IP datagram) ) sets ECE bit on receiver-to-sender ACK segment to notify sender of congestion source transport network link physical IP datagram ECN=00 ECE=1 ECN=11 TCP ACK segment destination transport network link physical Transport Layer 3-46 Chapter 3: summary principles behind transport layer : multiplexing, demultiplexing flow congestion instantiation, implementation in the Internet UDP TCP next: leaving the network edge (, transport layers) into the network core two network layer chapters: data plane plane Transport Layer 3-47 8