Computer Networks Lecture 9: Transport layer Part II Based on slides from D. Choffnes Northeastern U. and P. Gill from StonyBrook University Revised Autumn.

Slides:



Advertisements
Similar presentations
CS144 Review Session 4 April 25, 2008 Ben Nham
Advertisements

Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
CSCI 4550/8556 Computer Networks
Transmission Control Protocol (TCP)
Guide to TCP/IP, Third Edition
CSE534 – Fundamentals of Computer Networks Lecture 8-9: Transport (UDP, but mostly TCP) Based on slides by D. Choffnes Northeastern U Revised by P. Gill.
IS333, Ch. 26: TCP Victor Norman Calvin College 1.
Fundamentals of Computer Networks ECE 478/578 Lecture #20: Transmission Control Protocol Instructor: Loukas Lazos Dept of Electrical and Computer Engineering.
Transport Layer3-1 TCP. Transport Layer3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 CS492B Project #2 TCP Tutorial # Jin Hyun Ju.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Winter 2008CS244a Handout #61 CS244a: An Introduction to Computer Networks Handout 6: The Transport Layer, Transmission Control Protocol (TCP), and User.
1 Computer Networks: A Systems Approach, 5e Larry L. Peterson and Bruce S. Davie Chapter 5 End-to-End Protocols Copyright © 2010, Elsevier Inc. All rights.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
Provides a reliable unicast end-to-end byte stream over an unreliable internetwork.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Computer Networks 2 Lecture 2 TCP – I - Transport Protocols: TCP Segments, Flow control and Connection Setup.
CSE534 – Fundamentals of Computer Networks Lecture 8-9: Transport (UDP, but mostly TCP) Based on slides by D. Choffnes Northeastern U Revised by P. Gill.
TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)
TDC375 Winter 03/04 John Kristoff - DePaul University 1 Network Protocols Transmission Control Protocol (TCP)
Department of Electronic Engineering City University of Hong Kong EE3900 Computer Networks Transport Protocols Slide 1 Transport Protocols.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
Spring 2002CS 4611 Reliable Byte-Stream (TCP) Outline Connection Establishment/Termination Sliding Window Revisited Flow Control Adaptive Timeout.
1 Transport Layer Computer Networks. 2 Where are we?
CS 4700 / CS 5700 Network Fundamentals Lecture 11: Transport (UDP, but mostly TCP) Revised 2/9/2014.
CS 4700 / CS 5700 Network Fundamentals Lecture 11: Transport (UDP, but mostly TCP) Revised 7/27/2013.
TDTS21 Advanced Networking
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.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP Instructor: Dr. Li-Chuan Chen Date: 09/22/2003 Based in part upon slides.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP Lecture 13 November 13, TCP Background Transmission Control Protocol (TCP) TCP provides much of the functionality that IP lacks: reliable service.
CS332, Ch. 26: TCP Victor Norman Calvin College 1.
SMUCSE 4344 transport layer. SMUCSE 4344 transport layer end-to-end protocols –transport code runs only on endpoint hosts encapsulates network communications.
ECE453 – Introduction to Computer Networks Lecture 14 – Transport Layer (I)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 2.5 Internetworking Chapter 25 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
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.
1 TCP: Reliable Transport Service. 2 Transmission Control Protocol (TCP) Major transport protocol used in Internet Heavily used Completely reliable transfer.
Andmeside IRT 0030 loeng 605. okt Avo Ots telekommunikatsiooni õppetool raadio- ja sidetehnika instituut
Chapter 24 Transport Control Protocol (TCP) Layer 4 protocol Responsible for reliable end-to-end transmission Provides illusion of reliable network to.
81 Sidevõrgud IRT 0020 loeng okt Avo Ots telekommunikatsiooni õppetool, TTÜ raadio- ja sidetehnika inst.
Computer Networking Lecture 18 – More TCP & Congestion Control.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429/556 Introduction to Computer Networks The TCP Protocol Some slides used with permissions.
Computer Networks23-1 PART 5 Transport Layer. Computer Networks23-2 Position of Transport Layer Responsible for the delivery of a message from one process.
ECE 4110 – Internetwork Programming
CS 4700 / CS 5700 Network Fundamentals
Transport Protocols.
CSE390 Advanced Computer Networks Lecture 8-9: Transport (UDP, but mostly TCP) Based on slides by D. Choffnes Northeastern U Revised by P. Gill Fall 2014.
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 13: TCP Slides used with permissions from.
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
EE 122: Transport Protocols Kevin Lai October 16, 2002.
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.
Transport Layer3-1 Transport Layer If you are going through Hell Keep going.
CS 4700 / CS 5700 Network Fundamentals Lecture 11: Transport (UDP, but mostly TCP) Revised 3/2/2015.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
11 CS716 Advanced Computer Networks By Dr. Amir Qayyum.
Computer Networks 1000-Transport layer, TCP Gergely Windisch v spring.
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
Computer Networking Lecture 16 – Reliable Transport.
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
5. End-to-end protocols (part 1)
CS 3700 Networks and Distributed Systems
PART 5 Transport Layer Computer Networks.
Introduction of Transport Protocols
Transport Layer Unit 5.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Transport Layer: Congestion Control
Transport Protocols: TCP Segments, Flow control and Connection Setup
Presentation transcript:

Computer Networks Lecture 9: Transport layer Part II Based on slides from D. Choffnes Northeastern U. and P. Gill from StonyBrook University Revised Autumn 2015 by S. Laki

Transport Layer 2  Function:  Demultiplexing of data streams  Optional functions:  Creating long lived connections  Reliable, in-order packet delivery  Error detection  Flow and congestion control  Key challenges:  Detecting and responding to congestion  Balancing fairness against high utilization Application Presentation Session Transport Network Data Link Physical

 UDP – already discussed  TCP  Congestion Control  Evolution of TCP  Problems with TCP Outline 3

The Case for Multiplexing 4  Datagram network  No circuits  No connections  Clients run many applications at the same time  Who to deliver packets to?  IP header “protocol” field  8 bits = 256 concurrent streams  Insert Transport Layer to handle demultiplexing Packet Network Data Link Physical Transport

Demultiplexing Traffic 5 Endpoints identified by Network Transport Application P1P2P3P4P6P7P5 Host 1Host 2Host 3 Unique port for each application Applications share the same network Server applications communicate with multiple clients

Layering, Revisited 6 Application Transport Network Data Link Physical Host 1 Router Host 2 Physical  Lowest level end-to-end protocol  Transport header only read by source and destination  Routers view transport header as payload Application Transport Network Data Link Physical Network Data Link Layers communicate peer- to-peer

Options Transmission Control Protocol 7  Reliable, in-order, bi-directional byte streams  Port numbers for demultiplexing  Virtual circuits (connections)  Flow control  Congestion control, approximate fairness Destination Port Sequence Number Source Port Acknowledgement Number Advertised Window Urgent Pointer Flags Checksum Why these features? 4 HLen

Connection Setup 8  Why do we need connection setup?  To establish state on both hosts  Most important state: sequence numbers Count the number of bytes that have been sent Initial value chosen at random Why?  Important TCP flags (1 bit each)  SYN – synchronization, used for connection setup  ACK – acknowledge received data  FIN – finish, used to tear down connection

Three Way Handshake 9  Each side:  Notifies the other of starting sequence number  ACKs the other side’s starting sequence number ClientServer SYN SYN/ACK ACK Why Sequence # +1?

Connection Setup Issues 10  Connection confusion  How to disambiguate connections from the same host?  Random sequence numbers  Source spoofing  Kevin Mitnick  Need good random number generators!  Connection state management  Each SYN allocates state on the server  SYN flood = denial of service attack  Solution: SYN cookies

Connection Tear Down 11  Either side can initiate tear down  Other side may continue sending data  Half open connection  shutdown()  Acknowledge the last FIN  Sequence number + 1  What happens if 2 nd FIN is lost? ClientServer FIN ACK Data FIN ACK

Sequence Number Space 12  TCP uses a byte stream abstraction  Each byte in each stream is numbered  32-bit value, wraps around  Initial, random values selected during setup. Why?  Byte stream broken down into segments (packets)  Size limited by the Maximum Segment Size (MSS)  Set to limit fragmentation  Each segment has a sequence number Segment 8Segment 9Segment

Bidirectional Communication 13  Each side of the connection can send and receive  Different sequence numbers for each direction ClientServer Data (1460 bytes) Data/ACK (730 bytes) Data/ACK (1460 bytes) Seq.Ack.Seq.Ack Data and ACK in the same packet 231

Flow Control 14  Problem: how many packets should a sender transmit?  Too many packets may overwhelm the receiver  Size of the receivers buffers may change over time  Solution: sliding window  Receiver tells the sender how big their buffer is  Called the advertised window  For window size n, sender may transmit n bytes without receiving an ACK  After each ACK, the window slides forward  Window may go to zero!

Flow Control: Sender Side 15 Sequence Number Src. Port Acknowledgement Number Window Urgent Pointer Flags Checksum HL Packet Sent Dest. PortSrc. Port Acknowledgement Number Window Urgent Pointer Flags Checksum HL Packet Received Dest. Port Sequence Number ACKedSentTo Be SentOutside Window Window Must be buffered until ACKed

Sliding Window Example Time TCP is ACK Clocked Short RTT  quick ACK  window slides quickly Long RTT  slow ACK  window slides slowly

Observations 17  Throughput is ~ w/RTT  Sender has to buffer all unacknowledges packets, because they may require retransmission  Receiver may be able to accept out-of-order packets, but only up to buffer limits

What Should the Receiver ACK? 1. ACK every packet 2. Use cumulative ACK, where an ACK for sequence n implies ACKS for all k < n 3. Use negative ACKs (NACKs), indicating which packet did not arrive 4. Use selective ACKs (SACKs), indicating those that did arrive, even if not in order  SACK is an actual TCP extension 18

Sequence Numbers, Revisited 19  32 bits, unsigned  Why so big?  For the sliding window you need…  |Sequence # Space| > 2 * |Sending Window Size|  2 32 > 2 * 2 16  Guard against stray packets  IP packets have a maximum segment lifetime (MSL) of 120 seconds i.e. a packet can linger in the network for 2 minutes

Silly Window Syndrome 20  Problem: what if the window size is very small?  Multiple, small packets, headers dominate data  Equivalent problem: sender transmits packets one byte at a time 1. for (int x = 0; x < strlen(data); ++x) 2. write(socket, data + x, 1); Header Data Header Data Header Data Header Data

Nagle’s Algorithm If the window >= MSS and available data >= MSS: Send the data 2. Elif there is unACKed data: Enqueue data in a buffer until an ACK is received 3. Else: send the data  Problem: Nagle’s Algorithm delays transmissions  What if you need to send a packet immediately? 1. int flag = 1; 2. setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int)); Send a full packet Send a non-full packet if nothing else is happening

Error Detection 22  Checksum detects (some) packet corruption  Computed over IP header, TCP header, and data  Sequence numbers catch sequence problems  Duplicates are ignored  Out-of-order packets are reordered or dropped  Missing sequence numbers indicate lost packets  Lost segments detected by sender  Use timeout to detect missing ACKs  Need to estimate RTT to calibrate the timeout  Sender must keep copies of all data until ACK

Retransmission Time Outs (RTO) 23  Problem: time-out is linked to round trip time Initial Send ACK Retry RTO Initial Send ACK Retry RTO Timeout is too short What about if timeout is too long?

Round Trip Time Estimation 24  Original TCP round-trip estimator  RTT estimated as a moving average  new_rtt = α (old_rtt) + (1 – α )(new_sample)  Recommended α : (0.875 for most TCPs)  RTO = 2 * new_rtt (i.e. TCP is conservative) Data ACK Sample

RTT Sample Ambiguity 25  Karn’s algorithm: ignore samples for retransmitted segments Initial Send ACK Retry RTO Initial Send ACK Retry RTO Sample Sample?

Challenge of RTO in data centers 26  TCP Incast problem – E.g. Hadoop, Map Reduce, HDFS, GFS Many senders sending simultaneously to receiver Buffer at switch fills and packets are lost! No ACKs will come back  Wait RTO Challenges: Need to break synchronization RTO estimation designed for wide area Data centers have much smaller RTT

 Congestion Control  Evolution of TCP  Problems with TCP Outline 27

What is Congestion? 28  Load on the network is higher than capacity  Capacity is not uniform across networks Modem vs. Cellular vs. Cable vs. Fiber Optics  There are multiple flows competing for bandwidth Residential cable modem vs. corporate datacenter  Load is not uniform over time 10pm, Sunday night = Bittorrent Game of Thrones

Why is Congestion Bad? 29  Results in packet loss  Routers have finite buffers  Internet traffic is self similar, no buffer can prevent all drops  When routers get overloaded, packets will be dropped  Practical consequences  Router queues build up, delay increases  Wasted bandwidth from retransmissions  Low network “goodput”

The Danger of Increasing Load 30  Knee – point after which  Throughput increases very slow  Delay increases fast  In an M/M/1 queue  Delay = 1/(1 – utilization)  Cliff – point after which  Throughput  0  Delay  ∞ Congestion Collapse Load Goodput Delay KneeCliff Ideal point

Cong. Control vs. Cong. Avoidance 31 Congestion Collapse Goodput Knee Cliff Load Congestion Avoidance: Stay left of the knee Congestion Control: Stay left of the cliff

Advertised Window, Revisited 32  Does TCP’s advertised window solve congestion? NO  The advertised window only protects the receiver  A sufficiently fast receiver can max the window  What if the network is slower than the receiver?  What if there are other concurrent flows?  Key points  Window size determines send rate  Window must be adjusted to prevent congestion collapse

General Approaches 33  Do nothing, send packets indiscriminately  Many packets will drop, totally unpredictable performance  May lead to congestion collapse  Reservations  Pre-arrange bandwidth allocations for flows  Requires negotiation before sending packets  Must be supported by the network  Dynamic adjustment  Use probes to estimate level of congestion  Speed up when congestion is low  Slow down when congestion increases  Messy dynamics, requires distributed coordination