The Transport Layer CS168, Fall 2014 Scott Shenker (understudy to Sylvia Ratnasamy) Material thanks to Ion Stoica,

Slides:



Advertisements
Similar presentations
Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Advertisements

Data Communications and Computer Networks Chapter 3 CS 3830 Lecture 16 Omar Meqdadi Department of Computer Science and Software Engineering University.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 CS492B Project #2 TCP Tutorial # Jin Hyun Ju.
Winter 2008CS244a Handout #61 CS244a: An Introduction to Computer Networks Handout 6: The Transport Layer, Transmission Control Protocol (TCP), and User.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
OSI 7-Layer Model. Implementation of UDP and TCP CS587x Lecture 2 Department of Computer Science Iowa State University.
Chapter 7 – Transport Layer Protocols
Copyright 1999, S.D. Personick. All Rights Reserved. Telecommunications Networking II Lecture 32 Transmission Control Protocol (TCP) Ref: Tanenbaum pp:
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
CSE 461: Sliding Windows & ARQ. Next Topic  We begin on the Transport layer  Focus  How do we send information reliably?  Topics  The Transport layer.
Lecture 7 Transport Protocols: UDP, TCP
Computer Networks Transport Layer. Topics F Introduction  F Connection Issues F TCP.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
2: Application Layer 1 1DT066 Distributed Information System Chapter 3 Transport Layer.
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
Gursharan Singh Tatla Transport Layer 16-May
Wrapping Up IP + The Transport Layer EE 122, Fall 2013 Sylvia Ratnasamy Material thanks to Ion Stoica, Scott Shenker,
What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best.
Ch 3. Transport Layer Myungchul Kim
1 Transport Layer Computer Networks. 2 Where are we?
Go-Back-N ARQ  packets transmitted continuously (when available) without waiting for ACK, up to N outstanding, unACK’ed packets  a logically different.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
CS332, Ch. 26: TCP Victor Norman Calvin College 1.
University of the Western Cape Chapter 12: The Transport Layer.
3: Transport Layer 3a-1 8: Principles of Reliable Data Transfer Last Modified: 10/15/2015 7:04:07 PM Slides adapted from: J.F Kurose and K.W. Ross,
Computer Networking Lent Term M/W/F 11-midday LT1 in Gates Building Slide Set 4 Andrew W. Moore February
Copyright 2002, S.D. Personick. All Rights Reserved.1 Telecommunications Networking II Topic 20 Transmission Control Protocol (TCP) Ref: Tanenbaum pp:
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Networked & Distributed Systems TCP/IP Transport Layer Protocols UDP and TCP University of Glamorgan.
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
CSE 331: Introduction to Networks and Security Fall 2000 Instructor: Carl A. Gunter Slide Set 5.
Lec 17. 4/2/14 Anthony D. Joseph CS162 ©UCB Spring 2014 CS162 S ECTION 8.
CS/ECE 4381 Concepts Reverse-path forwarding Regular routing protocols compute shortest path tree, so forward multicast packets along “reverse” of this.
Chapter 3 Transport Layer Tami Meredith. A protocol defines: 1. Message Format (Syntax) 2. Rules of Communication (Semantics) 3. Synchronisation and other.
Transport Layer 3-1 Internet Transport Layer Lecture 8 Dr. Najla Al-Nabhan.
Chapter 13 Introduction to the Transport Layer
Transport Protocols.
Transport Layer: Sliding Window Reliability
1 Transport Layer: Basics Outline Intro to transport UDP Congestion control basics.
CS/EE 145A Reliable Transmission over Unreliable Channel II Netlab.caltech.edu/course.
© Janice Regan, CMPT 128, CMPT 371 Data Communications and Networking Principles of reliable data transfer 0.
CS162 Operating Systems and Systems Programming Lecture 15 Reliability, Transport Protocols March 16, 2011 Ion Stoica
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
TCP Flow Control – an illustration of distributed system thinking David E. Culler CS162 – Operating Systems and Systems Programming
CSE/EE 461 Sliding Windows and ARQ. 2 Last Time We finished up the Network layer –Internetworks (IP) –Routing (DV/RIP, LS/OSPF) It was all about routing:
EE 122: Transport Protocols Kevin Lai October 16, 2002.
1 Computer Communication & Networks Lecture 23 & 24 Transport Layer: UDP and TCP Waleed Ejaz
IT 424 Networks2 IT 424 Networks2 Ack.: Slides are adapted from the slides of the book: “Computer Networking” – J. Kurose, K. Ross Chapter 3: Transport.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
Computer Networking Lecture 16 – Reliable Transport.
Ch 3. Transport Layer Myungchul Kim
Ch 3. Transport Layer Myungchul Kim
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
CS162 Operating Systems and Systems Programming Lecture 11 Reliability, Transport Protocols October 5, 2011 Anthony D. Joseph and Ion Stoica
Chapter 9: Transport Layer
TCP.
CMPT 371 Data Communications and Networking
Introduction of Transport Protocols
Transport Layer Our goals:
Chapter 23 Introduction To Transport Layer
The Transport Layer Reliability
Computer Networks Protocols
Transport Layer 9/22/2019.
Presentation transcript:

The Transport Layer CS168, Fall 2014 Scott Shenker (understudy to Sylvia Ratnasamy) Material thanks to Ion Stoica, Jennifer Rexford, Nick McKeown, and many other colleagues

Preliminaries Sylvia will be back next week You are stuck with me this week Please ask questions…. I will ask a few questions during this lecture Someone should answer…. But for the rest of you, I ask questions to give you a chance to think, not because I want an answer…

The Transport Layer (brief review from last lecture)

From Lecture#3: Transport Layer Layer at end-hosts, between the application and network layer Transport Network Datalink Physical Transport Network Datalink Physical Network Datalink Physical Application Host A Host B Router

Why a transport layer? Transport layer and application both on host Why not just combine the two? And what should that code do anyway?

Why a transport layer? IP packets are addressed to a host but end-to- end communication is between application processes at hosts Need a way to decide which packets go to which applications (mux/demux) IP provides a weak service model (best-effort) Packets can be corrupted, delayed, dropped, reordered, duplicated No guidance on how much traffic to send and when Dealing with this is tedious for application developers

Role of the Transport Layer Communication between application processes Mux and demux from/to application processes Implemented using ports

Role of the Transport Layer Communication between application processes Provide common end-to-end services for app layer [optional] Reliable, in-order data delivery Well-paced data delivery too fast may overwhelm the network too slow is not efficient

Role of the Transport Layer Communication between processes Provide common end-to-end services for app layer [optional] TCP and UDP are the common transport protocols also SCTP, MTCP, SST, RDP, DCCP, …

Role of the Transport Layer Communication between processes Provide common end-to-end services for app layer [optional] TCP and UDP are the common transport protocols UDP is a minimalist, no-frills transport protocol only provides mux/demux capabilities

Role of the Transport Layer Communication between processes Provide common end-to-end services for app layer [optional] TCP and UDP are the common transport protocols UDP is a minimalist, no-frills transport protocol TCP is the whole-hog protocol offers apps a reliable, in-order, bytestream abstraction with congestion control but no performance guarantees (delay, bw, etc.)

Transport Design Issues

Context: Applications and Sockets Socket: software abstraction by which an application process exchanges network messages with the (transport layer in the) operating system socketID = socket(…, socket.TYPE) socketID.sendto(message, …) socketID.recvfrom(…) will cover in detail after midterm Two important types of sockets UDP socket: TYPE is SOCK_DGRAM TCP socket: TYPE is SOCK_STREAM

Ports Problem: deciding which app (socket) gets which packets Solution: port as a transport layer identifier (16 bits) packet carries source/destination port numbers in transport header OS stores mapping between sockets and ports Port: in packets Socket: in OS For UDP ports (SOCK_DGRAM) OS stores (local port, local IP address)  socket For TCP ports (SOCK_STREAM) OS stores (local port, local IP, remote port, remote IP)  socket

Two Questions Why the difference? For UDP ports (SOCK_DGRAM) OS stores (local port, local IP address)  socket For TCP ports (SOCK_STREAM) OS stores (local port, local IP, remote port, remote IP )  socket Why do you need to include local IP?

4-bit Version 4-bit Header Length 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Payload

4 5 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Payload

4 5 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 6 = TCP 17 = UDP 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Payload

4 5 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 6 = TCP 17 = UDP 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Payload 16-bit Source Port16-bit Destination Port More transport header fields ….

Recap: Multiplexing and Demultiplexing Host receives IP packets Each IP header has source and destination IP address Each Transport Layer header has source and destination port number Host uses IP addresses and port numbers to direct the message to appropriate socket UDP maps local destination port and address to socket TCP maps address pair and port pair to socket

Rest of Lecture More on ports UDP Reliable Transport Next lecture: Details of TCP

More on Ports Separate 16-bit port address space for UDP and TCP “Well known” ports (0-1023): everyone agrees which services run on these ports e.g., ssh:22, helps client know server’s port Services can listen on well-known port Ephemeral ports (most ): given to clients

UDP: User Datagram Protocol Lightweight communication between processes Avoid overhead and delays of ordered, reliable delivery UDP described in RFC 768 – (1980!) Destination IP address and port to support demultiplexing Optional error checking on the packet contents ( checksum field = 0 means “don’t verify checksum”) SRC port DST port checksumlength DATA

Question Why do UDP packets carry the sender’s port?

Why a transport layer? IP packets are addressed to a host but end-to- end communication is between application processes at hosts Need a way to decide which packets go to which applications (mux/demux) IP provides a weak service model (best-effort) Packets can be corrupted, delayed, dropped, reordered, duplicated

Reliable send send wait for wait for packets In a perfect world, reliable transport is easy

Reliable Transport In a perfect world, reliable transport is easy All the bad things best-effort can do a packet is corrupted (bit errors) a packet is lost (why?) a packet is delayed (why?) packets are reordered (why?) a packet is duplicated (why?)

Reliable Transport Mechanisms for coping with bad events Checksums: to detect corruption ACKs: receiver tells sender that it received packet NACK: receiver tells sender it did not receive packet Sequence numbers: a way to identify packets Retransmissions: sender resends packets Timeouts: a way of deciding when to resend a packet Forward error correction: a way to mask errors without retransmission Network encoding: an efficient way to repair errors ….

Dealing with Packet Corruption Time SenderReceiver   ack nack

Dealing with Packet Corruption Time SenderReceiver 1 1   ack(1) What if the ACK/NACK is corrupted? Packet #1 or #2? 2 P(2) P(1) Data and ACK packets carry sequence numbers

Dealing with Packet Loss Time SenderReceiver 1 1  ack(1) P(1) Timer-driven loss detection Set timer when packet is sent; retransmit on timeout Timeout P(2)

Dealing with Packet Loss (of ack) Time SenderReceiver 1 1  ack(1) P(1) Timeout P(2) duplicate!

Dealing with Packet Loss Time SenderReceiver ack(1) P(1) Timer-driven retx. can lead to duplicates Timeout P(2) duplicate! ack(1)

Components of a solution (so far) checksums (to detect bit errors) timers (to detect loss) acknowledgements (positive or negative) sequence numbers (to deal with duplicates) But we haven’t put them together into a coherent design…

Designing Reliable Transport

A Solution: “Stop and Wait” We have a correct reliable transport protocol! Probably the world’s most inefficient one send packet(I); (re)set timer; wait for ack If (ACK) I++; repeat If (NACK or TIMEOUT) send packet(I); (re)set timer; wait for ack If (ACK) I++; repeat If (NACK or TIMEOUT) wait for packet if packet is OK, send ACK else, send NACK wait for packet if packet is OK, send ACK else, send NACK repeat

37 Stop & Wait is Inefficient ACK DATA Sender Receiver RTT If TRANS << RTT then Throughput ~ DATA/RTT If TRANS << RTT then Throughput ~ DATA/RTT TRANS

Orders of Magnitude Transmission time for 10Gbps link: ~ microsecond for 1500 byte packet RTT: 1,000 kilometers ~ O(10) milliseconds

Three Design Decisions Which packets can sender send? Sliding window How does receiver ack packets? Cumulative Selective Which packets does sender resend? GBN Selective repeat

Sliding Window window = set of adjacent sequence numbers The size of the set is the window size; assume window size is n General idea: send up to n packets at a time Sender can send packets in its window Receiver can accept packets in its window Window of acceptable packets “slides” on successful reception/acknowledgement Window contains all packets that might still be in transit Sliding window often called “packets in flight”

Sliding Window Let A be the last ack’d packet of sender without gap; then window of sender = {A+1, A+2, …, A+n} Let B be the last received packet without gap by receiver, then window of receiver = {B+1,…, B+n} n B Received and ACK’d Acceptable but not yet received Cannot be received n A Already ACK’d Sent but not ACK’d Cannot be sent sequence number 

Throughput of Sliding Window If window size is n, then throughput is roughly MIN[ nDATA/RTT, Link Bandwidth] Compare to Stop and Wait: Data/RTT Two questions: What happens when n gets too large? How do we choose n?

Acknowledgements w/ Sliding Window Two common options cumulative ACKs: ACK carries next in-order sequence number that the receiver expects

Cumulative Acknowledgements (1) At receiver n B Received and ACK’d Acceptable but not yet received Cannot be received After receiving B+1, B+2 n B new = B+2 Receiver sends ACK(B+3) = ACK(B new +1)

Cumulative Acknowledgements (2) At receiver n B Received and ACK’d Acceptable but not yet received Cannot be received After receiving B+4, B+5 n B Receiver sends ACK(B+1)

Acknowledgements w/ Sliding Window Two common options cumulative ACKs: ACK carries next in-order sequence number the receiver expects selective ACKs: ACK individually acknowledges correctly received packets Selective ACKs offer more precise information but require more complicated book-keeping

Sliding Window Protocols Resending packets: two canonical approaches Go-Back-N Selective Repeat Many variants that differ in implementation details

Go-Back-N (GBN) Sender transmits up to n unacknowledged packets Receiver only accepts packets in order discards out-of-order packets (i.e., packets other than B+1) Receiver uses cumulative acknowledgements i.e., sequence# in ACK = next expected in-order sequence# Sender sets timer for 1 st outstanding ack (A+1) If timeout, retransmit A+1, …, A+n

Sliding Window with GBN Let A be the last ack’d packet of sender without gap; then window of sender = {A+1, A+2, …, A+n} Let B be the last received packet without gap by receiver, then window of receiver = {B+1,…, B+n} n A Already ACK’d Sent but not ACK’d Cannot be sent n B Received and ACK’d Acceptable but not yet received Cannot be received sequence number 

GBN Example w/o Errors Time Window size = 3 packets SenderReceiver 1 {1} 2 {1, 2} 3 {1, 2, 3} 4 {2, 3, 4} 5 {3, 4, 5} Sender Window Receiver Window 6 {4, 5, 6}

GBN Example with Errors Window size = 3 packets SenderReceiver Timeout Packet

Selective Repeat (SR) Sender: transmit up to n unacknowledged packets Assume packet k is lost, k+1 is not Receiver: indicates packet k+1 correctly received Sender: retransmit only packet k on timeout Efficient in retransmissions but complex book-keeping need a timer per packet

SR Example with Errors Time SenderReceiver ACK=5 Window size = 3 packets {1} {1, 2} {1, 2, 3} {2, 3, 4} {3, 4, 5} {4, 5, 6} {7, 8, 9} ACK=6 {4,5,6} Timeout Packet 4 ACK=4

GBN vs Selective Repeat When would GBN be better? When would SR be better?

Observations With sliding windows, it is possible to fully utilize a link, provided the window size is large enough. Sender has to buffer all unacknowledged packets, because they may require retransmission Receiver may be able to accept out-of-order packets, but only up to its buffer limits Implementation complexity depends on protocol details (GBN vs. SR)

Recap: components of a solution Checksums (for error detection) Timers (for loss detection) Acknowledgments cumulative selective Sequence numbers (duplicates, windows) Sliding Windows (for efficiency) Reliability protocols use the above to decide when and what to retransmit or acknowledge

What does TCP do? Most of our previous tricks + a few differences Sequence numbers are byte offsets Sender and receiver maintain a sliding window Receiver sends cumulative acknowledgements (like GBN) Sender maintains a single retx. timer Receivers do not drop out-of-sequence packets (like SR) Introduces fast retransmit : optimization that uses duplicate ACKs to trigger early retx (next time) Introduces timeout estimation algorithms (next time)

Next Time TCP Reliability Congestion control