Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
1DT057 Distributed Information System Transport Layer 1 2: Application Layer Chapter 3 CHAPTER 3: TRANSPORT LAYER multiplexing/demultipl exing reliable data transfer flow control congestion control learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport Transport Layer Our goals: understand principles behind transport layer services: 3-2 CHAPTER 3 OUTLINE 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control Congestion control Transport Layer 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3-3 TRANSPORT VS. NETWORK LAYER network layer: logical communication between hosts transport layer: logical communication between processes Transport Layer relies on, enhances, network layer services 3-4 INTERNET TRANSPORT-LAYER PROTOCOLS reliable, in-order delivery (TCP) unreliable, unordered delivery: UDP congestion control flow control connection setup no-frills extension of “besteffort” IP services not available: delay guarantees bandwidth guarantees network data link physical network data link physical network data link physicalnetwork network data link physical Transport Layer application transport network data link physical data link physical network data link physical application transport network data link physical 3-5 CHAPTER 3 OUTLINE 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control Congestion control Transport Layer 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 3-6 MULTIPLEXING/DEMULTIPLEXING Multiplexing at send host: Demultiplexing at rcv host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) delivering received segments to correct socket = socket application transport network link = process P3 P1 P1 application P2 P4 application transport transport network network link link physical host 1 physical physical host 3 host 2 Transport Layer 3-7 Hhost OW DEMULTIPLEXING WORKS receives IP datagrams 32 bits source port # dest port # other header fields Transport Layer each datagram has source IP address, destination IP address each datagram carries 1 transport-layer segment each segment has source, destination port number host uses IP addresses & port numbers to direct segment to appropriate socket application data (message) TCP/UDP segment format 3-8 CONNECTIONLESS DEMUX (CONT) DatagramSocket serverSocket = new DatagramSocket(6428); SP: 6428 SP: 6428 DP: 9157 DP: 5775 SP: 9157 client IP: A P1 P1 P3 DP: 6428 SP provides “return address” Transport Layer P2 SP: 5775 server IP: C DP: 6428 Client IP:B 3-9 CHAPTER 3 OUTLINE 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control congestion control Transport Layer 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 310 UDP: USER DATAGRAM PROTOCOL [RFC 768] Why is there a UDP? no connection establishment (which can add delay) simple: no connection state at sender, receiver small segment header no congestion control: UDP can blast away as fast as desired Transport Layer “no frills,” “bare bones” Internet transport protocol “best effort” service, UDP segments may be: lost delivered out of order to app connectionless: no handshaking between UDP sender, receiver each UDP segment handled independently of others 311 UDP: MORE other UDP uses DNS SNMP reliable transfer over UDP: add reliability at application layer application-specific error recovery! segment, including header 32 bits source port # dest port # length checksum Transport Layer often used for streaming multimedia apps loss tolerant Length, in bytes of UDP rate sensitive Application data (message) UDP segment format 312 CHAPTER 3 OUTLINE 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control congestion control Transport Layer 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 313 PRINCIPLES OF RELIABLE DATA TRANSFER important in app., transport, link layers top-10 list of important networking topics! Transport Layer characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) 314 PRINCIPLES OF RELIABLE DATA TRANSFER important in app., transport, link layers top-10 list of important networking topics! Transport Layer characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) 315 PRINCIPLES OF RELIABLE DATA TRANSFER important in app., transport, link layers top-10 list of important networking topics! Transport Layer characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) 316 RDT3.0 EXAMPLE Transport Layer 317 RDT3.0 EXAMPLE Transport Layer 318 PERFORMANCE OF RDT3.0 rdt3.0 works, but performance stinks ex: 1 Gbps link, 15 ms prop. delay, 8000 bit packet: Transport Layer L 8000bits d trans 8 microsecon ds 9 R 10 bps U sender: utilization – fraction of time sender busy sending U sender = L/R RTT + L / R = .008 30.008 = 0.00027 microsec onds 1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link network protocol limits use of physical resources! 319 RDT3.0: STOP-AND-WAIT OPERATION sender receiver first packet bit transmitted, t = 0 last packet bit transmitted, t = L / R Transport Layer first packet bit arrives last packet bit arrives, send ACK RTT ACK arrives, send next packet, t = RTT + L / R U = sender L/R RTT + L / R = .008 30.008 = 0.00027 microsec onds 320 PIPELINED PROTOCOLS Pipelining: sender allows multiple, “in-flight”, yetto-be-acknowledged pkts range of sequence numbers must be increased buffering at sender and/or receiver Transport Layer Two generic forms of pipelined protocols: go-Back-N, 3selective repeat 21 PIPELINING: INCREASED UTILIZATION sender receiver first packet bit transmitted, t = 0 last bit transmitted, t = L / R RTT Transport Layer first packet bit arrives last packet bit arrives, send ACK last bit of 2nd packet arrives, send ACK last bit of 3rd packet arrives, send ACK ACK arrives, send next packet, t = RTT + L / R Increase utilization by a factor of 3! U sender = 3*L/R RTT + L / R = .024 30.008 = 0.0008 microsecon ds 3-22 PIPELINING PROTOCOLS doesn’t ACK pkt if there’s a gap sender: has timer for oldest unACKed pkt if timer expires: retransmit all unACKed packets Selective Repeat: overview sender: up to N unACKed packets in pipeline receiver: ACKs individual pkts sender: maintains timer for each unACKed pkt Transport Layer Go-back-N: overview sender: up to N unACKed pkts in pipeline receiver: only sends cumulative ACKs if timer expires: retransmit only unACKed packet 323 GO-BACK-N Sender: Transport Layer k-bit seq # in pkt header “window” of up to N, consecutive unACKed pkts allowed ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” may receive duplicate ACKs (see receiver) timer for each in-flight pkt 3 timeout(n): retransmit pkt n and all higher seq # pkts in window 24 GBN IN ACTION Transport Layer 325 GBN DEMO Transport Layer http://www.cs.mum.edu/courses/cs450/GoBackN.htm 326 SELECTIVE REPEAT receiver individually acknowledges all correctly received pkts sender only resends pkts for which ACK not received buffers pkts, as needed, for eventual in-order delivery to upper layer Transport Layer sender timer for each unACKed pkt sender window N consecutive seq #’s again limits seq #s of sent, unACKed pkts 327 SELECTIVE REPEAT: SENDER, RECEIVER WINDOWS Transport Layer 328 SELECTIVE REPEAT sender data from above : timeout(n): resend pkt n, restart timer ACK(n) in [sendbase,sendbase+N]: mark pkt n as received if n smallest unACKed pkt, advance window base to next unACKed seq # send ACK(n) out-of-order: buffer Transport Layer if next available seq # in window, send pkt receiver pkt n in [rcvbase, rcvbase+N-1] in-order: deliver (also deliver buffered, in-order pkts), advance window to next not-yet-received pkt pkt n in [rcvbase-N,rcvbase-1] ACK(n) otherwise: ignore 329 SELECTIVE REPEAT IN ACTION Transport Layer 330 SELECTIVE REPEAT: DILEMMA Example: receiver sees no difference in two scenarios! incorrectly passes duplicate data as new in (a) Q: what relationship between seq # size and window size? Transport Layer seq #’s: 0, 1, 2, 3 window size=3 331 SELECTIVE REPEAT DEMO Transport Layer http://www.eecis.udel.edu/~amer/450/TransportApplets/ SR/SRindex.html 332 CHAPTER 3 OUTLINE 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control Congestion control Transport Layer 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 333 TCP: OVERVIEW socket door point-to-point: reliable, in-order byte steam: pipelined: send & receive buffers application writes data application reads data TCP send buffer TCP receive buffer segment full duplex data: connection-oriented: flow controlled: socket door Transport Layer RFCS: 793, 1122, 1323, 2018, 2581 334 TCP SEQ. #’S AND ACKS Host A User types ‘C’ Host B Transport Layer Seq. #’s: byte stream “number” of first byte in segment’s data ACKs: seq # of next byte expected from other side cumulative ACK host ACKs receipt of ‘C’, echoes back ‘C’ host ACKs receipt of echoed ‘C’ simple telnet scenario time 335 TCP RELIABLE DATA TRANSFER retransmissions are triggered by: timeout events duplicate ACKs Transport Layer TCP creates rdt service on top of IP’s unreliable service pipelined segments cumulative ACKs TCP uses single retransmission timer 336 TCP: RETRANSMISSION SCENARIOS Host A X loss Sendbase = 100 SendBase = 120 SendBase = 100 time SendBase = 120 lost ACK scenario Host B Seq=92 timeout Seq=92 timeout Host B Transport Layer timeout Host A time 3premature timeout 37 TCP RETRANSMISSION SCENARIOS (MORE) Host B X loss Transport Layer timeout Host A SendBase = 120 time Cumulative ACK scenario 338 TCP FLOW CONTROL flow control receive side of TCP connection has a receive buffer: (currently) TCP data application IP unused buffer (in buffer) process datagrams space Transport Layer sender won’t overflow receiver’s buffer by transmitting too much, too fast speed-matching service: matching send rate to receiving application’s drain rate app process may be slow at reading from buffer 339 CHAPTER 3 OUTLINE 3.5 Connection-oriented transport: TCP segment structure reliable data transfer flow control congestion control Transport Layer 3.1 Transport-layer services 3.2 Multiplexing and demultiplexing 3.3 Connectionless transport: UDP 3.4 Principles of reliable data transfer 340 PRINCIPLES OF CONGESTION CONTROL Transport Layer Congestion: informally: “too many sources sending too much data too fast for network to handle” different from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) 341 TCP CONGESTION CONTROL: goal: TCP sender should transmit as fast as possible, but without congesting network Q: how to find rate just below congestion level decentralized: each TCP sender sets its own rate, Transport Layer based on implicit feedback: ACK: segment received (a good thing!), network not congested, so increase sending rate lost segment: assume loss due to congested network, so decrease sending rate 342 TCP CONGESTION CONTROL: BANDWIDTH PROBING “probing for bandwidth”: increase transmission rate continue to increase on ACK, decrease on loss (since available bandwidth is changing, depending on other connections in network) ACKs being received, so increase rate sending rate Transport Layer on receipt of ACK, until eventually loss occurs, then decrease transmission rate X X loss, so decrease rate X X TCP’s “sawtooth” behavior X time 343 CHAPTER 3: SUMMARY principles behind transport layer services: instantiation and implementation in the Internet UDP TCP Next: leaving the network “edge” (application, transport layers) into the network “core” Transport Layer multiplexing, demultiplexing reliable data transfer flow control congestion control 344