Transport Layer Transport Layer Outline Mobile network Transport-layer Connection-oriented Global ISP services transport: TCP Transport Layer Multiplexing and segment structure Home network demultiplexing reliable data transfer Regional ISP flow control Connectionless connection management Yanmin Zhu transport: UDP Principles of congestion Institutional network Principles of reliable Department of Computer control data transfer Science and Engineering TCP congestion control CSE Department CSE Department 1 2 Transport Layer Transport Layer TCP segment structure TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 32 bits point-to-point: full duplex data: URG: urgent data counting source port # dest port # (generally not used) by bytes one sender, one receiver bi-directional data flow sequence number of data ACK: ACK # in same connection reliable, in-order byte (not segments!) acknowledgement number valid MSS: maximum segment steam: head not U A P R S Receive window PSH: push data now F size len used no “message boundaries” # bytes (generally not used) checksum Urg data pnter connection-oriented: rcvr willing pipelined: to accept handshaking (exchange RST, SYN, FIN: Options (variable length) TCP congestion and flow connection estab of control msgs) init’s control set window size (setup, teardown sender, receiver state commands) send & receive buffers before data exchange application data flow controlled: Internet (variable length) checksum application application sender will not writes data reads data (as in UDP) socket socket overwhelm receiver door door TCP TCP send buffer receive buffer segment CSE Department CSE Department 3 4 Transport Layer Transport Layer TCP Round Trip Time and Timeout TCP seq. #’s and ACKs simple telnet scenario Seq. #’s: byte stream Host A Host B S D Q: how to set TCP timeout “number” of first User value? byte in segment’s types data longer than RTT host ACKs ‘C’ ACKs: but RTT varies receipt of RTT1 seq # of next byte ‘C’, echoes expected from too short : premature timeout other side back ‘C’ unnecessary cumulative ACK host ACKs retransmissions RTT2 receipt Q: how receiver handles too long : slow reaction to out-of-order segments of echoed segment loss A: TCP spec doesn’t ‘C’ say, - up to time implementor CSE Department CSE Department 5 6 1
Transport Layer Transport Layer RTT Estimation RTT Estimation – Basic Idea SampleRTT : measured time from segment EstimatedRTT transmission until ACK receipt = (1- )*EstimatedRTT + *SampleRTT ignore retransmissions SampleRTT will vary, want estimated RTT Exponential weighted moving average “smoother” influence of past sample decreases average several recent measurements, not just exponentially fast current SampleRTT typical value: = 0.125 CSE Department CSE Department 7 8 Transport Layer Transport Layer Setting the timeout Example RTT estimation: RTT: gaia.cs.umass.edu to fantasia.eurecom.fr EstimtedRTT plus “ safety margin ” 350 large variation in EstimatedRTT -> larger safety margin first estimate of how much SampleRTT deviates from EstimatedRTT: 300 250 DevRTT = (1- )*DevRTT + RTT (milliseconds) *|SampleRTT-EstimatedRTT| 200 (typically, = 0.25) 150 Then set timeout interval: 100 TimeoutInterval = EstimatedRTT + 4*DevRTT 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) SampleRTT Estimated RTT CSE Department CSE Department 9 10 TCP Transport Layer Transport Layer Outline TCP reliable data transfer Retransmissions are TCP creates rdt Transport-layer Connection-oriented triggered by: service on top of IP’s services transport: TCP unreliable service timeout events Multiplexing and segment structure duplicate acks Pipelined segments demultiplexing reliable data transfer flow control Cumulative acks Connectionless connection management Initially consider transport: UDP TCP uses single Principles of congestion simplified TCP sender retransmission timer Principles of reliable control ignore duplicate acks data transfer TCP congestion control ignore flow control, congestion control CSE Department CSE Department 11 12 2
Transport Layer Transport Layer TCP sender events: Illustration data rcvd from app: timeout: Create segment with retransmit segment seq # that caused timeout Segment Segment seq # is byte-stream restart timer number of first data Ack rcvd: byte in segment If acknowledges start timer if not previously unacked already running (think segments of timer as for oldest update what is known to Seq # unacked segment) be acked expiration interval: start timer if there are outstanding segments SendBase NextSeqNumber TimeOutInterval CSE Department CSE Department 13 14 Transport Layer Transport Layer 3 Events NextSeqNum = InitialSeqNum TCP ( 3 ) ACK SendBase = InitialSeqNum loop (forever) { sender switch(event) ( 1 ) Called above ACK(y) (simplified) event: data received from application above create TCP segment with sequence number NextSeqNum if (timer currently not running) start timer pass segment to IP Comment: NextSeqNum = NextSeqNum + length(data) • SendBase-1: last cumulatively event: timer timeout retransmit not-yet-acknowledged segment with ack’ed byte smallest sequence number Example: start timer • SendBase-1 = 71; y= 73, so the rcvr event: ACK received, with ACK field value of y Seq # if (y > SendBase) { wants 73+ ; SendBase = y y > SendBase, so if (there are currently not-yet-acknowledged segments) that new data is start timer SendBase NextSeqNumber } acked } /* end of loop forever */ ( 2 ) Timeout CSE Department CSE Department 15 16 Transport Layer Transport Layer TCP: retransmission scenarios TCP: retransmission scenarios Host A Host B Host A Host B Seq=92 timeout timeout X loss Sendbase = 100 Seq=92 timeout SendBase = 120 SendBase SendBase = 100 = 120 time time premature timeout lost ACK scenario CSE Department CSE Department 17 18 3
Transport Layer Transport Layer TCP retransmission scenarios (more) Fast Retransmit Idea: duplicate ACKs Host A Host B Time-out period often relatively long: long delay before resending lost packet timeout If sender receives 3 X Detect lost segments loss ACKs for the same via duplicate ACKs. data, it supposes that Sender often sends SendBase segment after ACKed many segments back-to- = 120 back data was lost: If segment is lost, fast retransmit: resend there will likely be many segment before timer time duplicate ACKs. expires Cumulative ACK scenario CSE Department CSE Department 19 20 Transport Layer Transport Layer Fast retransmit algorithm: Host A Host B event: ACK received, with ACK field value of y X if (y > SendBase) { SendBase = y if (there are currently not-yet-acknowledged segments) start timer } timeout else { increment count of dup ACKs received for y if (count of dup ACKs received for y = 3) { resend segment with sequence number y } a duplicate ACK for fast retransmit time already ACKed segment Resending a segment after triple duplicate ACK CSE Department CSE Department 21 22 Transport Layer Transport Layer Outline TCP Flow Control flow control sender won’t overflow Transport-layer Connection-oriented receive side of TCP receiver’s buffer by services transport: TCP connection has a transmitting too much, receive buffer: Multiplexing and segment structure too fast demultiplexing reliable data transfer flow control Connectionless speed-matching connection management transport: UDP service: matching the Principles of congestion send rate to the Principles of reliable control data transfer receiving app’s drain TCP congestion control rate Potential problem: app process may be slow at reading from buffer CSE Department CSE Department 23 24 4
Recommend
More recommend