TCP Basics : Computer Networking. Overview. What s Different From Link Layers? Introduction to TCP. TCP reliability Assigned reading

Similar documents
Functionality Split Computer Networking. Transport Protocols. Overview. Multiplexing & Demultiplexing

Transport Layer: Outline

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

CE693 Advanced Computer Networks

Outline Computer Networking. Functionality Split. Transport Protocols

TCP congestion control:

Detecting half-open connections. Observed TCP problems

Announcements Computer Networking. What was hard. Midterm. Lecture 16 Transport Protocols. Avg: 62 Med: 67 STD: 13.

CSE/EE 461 Lecture 12 TCP. A brief Internet history...

Outline Computer Networking. Transport Protocols. Functionality Split. Review 2 Transport Protocols

TCP. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli (Slides by Christos Papadopoulos, remixed by Lorenzo De Carli)

Overview. TCP congestion control Computer Networking. TCP modern loss recovery. TCP modeling. TCP Congestion Control AIMD

Outline Computer Networking. TCP slow start. TCP modeling. TCP details AIMD. Congestion Avoidance. Lecture 18 TCP Performance Peter Steenkiste

Transport Layer: outline

TCP Overview. Connection-oriented Byte-stream

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 5 - Part 2

Fast Retransmit. Problem: coarsegrain. timeouts lead to idle periods Fast retransmit: use duplicate ACKs to trigger retransmission

CS457 Transport Protocols. CS 457 Fall 2014

7. TCP 최양희서울대학교컴퓨터공학부

EE 122: Transport Protocols. Kevin Lai October 16, 2002

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

05 Transmission Control Protocol (TCP)

Overview. TCP & router queuing Computer Networking. TCP details. Workloads. TCP Performance. TCP Performance. Lecture 10 TCP & Routers

Chapter 24. Transport-Layer Protocols

Connection-oriented (virtual circuit) Reliable Transfer Buffered Transfer Unstructured Stream Full Duplex Point-to-point Connection End-to-end service

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

TCP Service Model. Today s Lecture. TCP Support for Reliable Delivery. EE 122:TCP, Connection Setup, Reliability

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

CS 356: Introduction to Computer Networks. Lecture 16: Transmission Control Protocol (TCP) Chap. 5.2, 6.3. Xiaowei Yang

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

CSCD 330 Network Programming

CS4700/CS5700 Fundamentals of Computer Networks

User Datagram Protocol (UDP):

Kent State University

TCP : Fundamentals of Computer Networks Bill Nace

Outline. User Datagram Protocol (UDP) Transmission Control Protocol (TCP) Transport layer (cont.) Transport layer. Background UDP.

CS419: Computer Networks. Lecture 10, Part 2: Apr 11, 2005 Transport: TCP mechanics (RFCs: 793, 1122, 1323, 2018, 2581)

COMP/ELEC 429/556 Introduction to Computer Networks

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

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

Transport Layer TCP / UDP

image 3.8 KB Figure 1.6: Example Web Page

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

TCP and Congestion Control (Day 1) Yoshifumi Nishida Sony Computer Science Labs, Inc. Today's Lecture

Networked Systems and Services, Fall 2018 Chapter 3

End-to-End Protocols. End-to-End Protocols

User Datagram Protocol

8. TCP Congestion Control

Intro to LAN/WAN. Transport Layer

Reliable Byte-Stream (TCP)

Congestion / Flow Control in TCP

Congestion Collapse in the 1980s

Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

Multiple unconnected networks

TCP so far Computer Networking Outline. How Was TCP Able to Evolve

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

The Transport Layer: TCP & Reliable Data Transfer

Chapter 3- parte B outline

Networked Systems and Services, Fall 2017 Reliability with TCP

CSC 401 Data and Computer Communications Networks

Lecture 3: The Transport Layer: UDP and TCP

ECE 435 Network Engineering Lecture 10

Lecture 4: Congestion Control

11/24/2009. Fundamentals of Computer Networks ECE 478/578. Flow Control in TCP

COMPUTER NETWORKS CS CS 55201

COMPUTER NETWORKS CS CS 55201

Outline. CS5984 Mobile Computing

Sequence Number. Acknowledgment Number. Checksum. Urgent Pointer plus Sequence Number indicates end of some URGENT data in the packet

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

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

TCP: Transmission Control Protocol UDP: User Datagram Protocol TCP - 1

Transport Protocols and TCP

Fall 2012: FCM 708 Bridge Foundation I

Transport Layer (Congestion Control)

TCP: Flow and Error Control

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

CSCE 463/612 Networks and Distributed Processing Spring 2017

Transmission Control Protocol (TCP)

Last Class. CSE 123b Communications Software. Today. Naming Processes/Services. Transmission Control Protocol (TCP) Picking Port Numbers.

Transport protocols. Transport Layer 3-1

Problem. Chapter Outline. Chapter Goal. End-to-end Protocols. End-to-end Protocols. Chapter 5. End-to-End Protocols

Some slides courtesy David Wetherall. Communications Software. Lecture 4: Connections and Flow Control. CSE 123b. Spring 2003.

Chapter 7. The Transport Layer

Internet transport protocols

Introduction to Networks and the Internet

Programming Assignment 3: Transmission Control Protocol

TCP/IP Networking. Part 4: Network and Transport Layer Protocols

CNT 6885 Network Review on Transport Layer

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Internet Protocols Fall Outline

Chapter 5 End-to-End Protocols

TCP/IP Protocol Suite 1

Chapter 3 Transport Layer

CS 640 Introduction to Computer Networks Spring 2009

Transport Protocols & TCP TCP

TCP Adaptive Retransmission Algorithm - Original TCP. TCP Adaptive Retransmission Algorithm Jacobson

ECE 333: Introduction to Communication Networks Fall 2001

10 minutes survey (anonymous)

TCP/IP Performance ITL

Transcription:

TCP Basics 15-744: Computer Networking TCP reliability Assigned reading [FF96] Simulation-based Comparisons of Tahoe, Reno, and SACK TCP L-9 TCP Basics 2 Key Things You Should Know Already Port numbers TCP/UDP checksum Sliding window flow control Sequence numbers TCP connection setup Overview TCP introduction TCP reliability: timer-driven TCP reliability: data-driven 3 4 Introduction to TCP Communication abstraction: Reliable Ordered Point-to-point Byte-stream Full duplex Flow and congestion controlled Protocol implemented entirely at the ends Fate sharing What s Different From Link Layers? Logical link vs. physical link Must establish connection Variable RTT May vary within a connection Reordering How long can packets live max segment lifetime Can t expect endpoints to exactly match link Buffer space availability Transmission rate Don t directly know transmission rate 5 6 1

Evolution of TCP TCP Through the 1990s 1975 Three-way handshake Raymond Tomlinson In SIGCOMM 75 1974 TCP described by Vint Cerf and Bob Kahn In IEEE Trans Comm 1984 Nagel s algorithm to reduce overhead 1987 of small packets; Karn s algorithm 1990 predicts congestion to better estimate 4.3BSD Reno collapse round-trip time fast retransmit delayed ACK s 1983 BSD Unix 4.2 1986 1988 supports TCP/IP Congestion Van Jacobson s collapse algorithms observed congestion avoidance 1982 and congestion control TCP & IP (most implemented in RFC 793 & 791 4.3BSD Tahoe) 1993 TCP Vegas (Brakmo et al) real congestion avoidance 1994 T/TCP (Braden) Transaction TCP 1994 ECN (Floyd) Explicit Congestion Notification 1996 SACK TCP (Floyd et al) Selective Acknowledgement 1996 1996 Hoe FACK TCP Improving TCP (Mathis et al) startup extension to SACK 1975 1980 1985 1990 1993 1994 1996 7 8 Integrity & Demultiplexing Port numbers Demultiplex from/to process Servers wait on well known ports (/etc/services) Checksum Is it sufficient to just checksum the packet contents? No, need to ensure correct source/destination Pseudoheader portion of IP hdrthat are critical Checksum covers Pseudoheader, transport hdr, and packet body UDP provides just integrity and demux TCP Header Flags: SYN FIN RESET PUSH URG ACK Source port Destination port Sequence number Acknowledgement HdrLen 0 Flags Advertised window Checksum Urgent pointer Options (variable) Data 9 10 TCP Flow Control Window Flow Control: Send Side TCP is a sliding window protocol For window size n, can send up to n bytes without receiving an acknowledgement When the data is acknowledged then the window slides forward Each packet advertises a window size Indicates number of bytes the receiver has space for Original TCP always sent entire window Congestion control now limits this Sent and acked window Sent but not acked Not yet sent Next to be sent 11 12 2

Window Flow Control: Receive Side Receive buffer Acked but not delivered to user Not yet acked window TCP Persist What happens if window is 0? Receiver updates window when application reads data What if this update is lost? TCP Persist state Sender periodically sends 1 byte packets Receiver responds with ACK even if it can t store the packet 13 14 Connection Establishment A and B must agree on initial sequence number selection Use 3-way handshake Sequence Number Selection Why not simply chose 0? Must avoid overlap with earlier incarnation A B SYN + Seq A SYN+ACK-A + Seq B ACK-B 15 16 Connection Setup Connection Tear-down SYN RCVD Send FIN passive OPEN create TCB rcvsyn snd SYN ACK rcvack of SYN D LISTEN rcvsyn snd ACK ESTAB delete TCB SEND snd SYN RcvSYN, ACK Snd ACK delete TCB active OPEN create TCB Snd SYN SYN SENT Normal termination Allow unilateral close TCP must continue to receive data even after closing Cannot close connection immediately What if a new connection restarts and uses same sequence number? 17 18 3

Tear-down Packet Exchange Connection Tear-down Sender FIN FIN-ACK FIN Receiver Data write Data ack send FIN FIN WAIT-1 FIN WAIT-2 send FIN rcvfin snd ACK ESTAB rcvfin+ack snd ACK CLOSING rcvfin send ACK rcvack of FIN WAIT snd FIN rcvack of FIN LAST-ACK FIN-ACK rcvfin snd ACK TIME WAIT out=2msl delete TCB D 19 20 Detecting Half-open Connections TCP A 1. (CRASH) 2. D 3. SYN-SENT <SEQ=400><CTL=SYN> 4. (!!) <SEQ=300><ACK=100><CTL=ACK> 5. SYN-SENT <SEQ=100><CTL=RST> 6. SYN-SENT 7. SYN-SENT <SEQ=400><CTL=SYN> TCP B (send 300, receive 100) ESTABLISHED (??) ESTABLISHED (Abort!!) D Observed TCP Problems Too many small packets Silly window syndrome Nagel s algorithm Initial sequence number selection Amount of state maintained 21 22 Silly Window Syndrome Problem: (Clark, 1982) If receiver advertises small increases in the receive window then the sender may waste time sending lots of small packets Solution Receiver must not advertise small window increases Increase window by min(mss,recvbuffer/2) Nagel s Algorithm Small packet problem: Don t want to send a 41 byte packet for each keystroke How long to wait for more data? Solution: Allow only one outstanding small (not full sized) segment that has not yet been acknowledged 23 24 4

Why is Selecting ISN Important? Suppose machine selects ISN based on predictable sequence Fred has.rhosts to allow login to from Y Evil Ed attacks Disables host Y denial of service attack Make a bunch of connections to host Determine ISN pattern a guess next ISN Fake pkt1: [<src Y><dst >, guessed ISN] Fake pkt2: desired command Wait Issues Web servers not clients close connection first Established Fin-Waits -Wait Closed Why would this be a problem? -Wait state lasts for 2 * MSL MSL is should be 120 seconds (is often 60s) Servers often have order of magnitude more connections in -Wait 25 26 Overview TCP introduction TCP reliability: timer-driven TCP reliability: data-driven Reliability Challenges Like reliability on links Similar techniques (timeouts, acknowledgements, etc.) New challenges Congestion related losses Variable packet delays What should the timeout be? Reordering of packets Ensure sequences numbers are not reused How long to packets live? MSL = 120 seconds based on IP behavior 27 28 Standard Data Transfer Sliding window with cumulative acks Ack field contains last in-order packet received Duplicate acks sent when out-of-order packet received Does TCP need to send an ack for every packet? Delayed acks Delayed ACKS Problem: In request/response programs, you send separate ACK and Data packets for each transaction Solution: Don t ACK data immediately Wait 200ms (must be less than 500ms why?) Must ACK every other packet Must not delay duplicate ACKs 29 30 5

Round-trip Estimation Wait at least one RTT before retransmitting Importance of accurate RTT estimators: Low RTT unneeded retransmissions High RTT poor throughput RTT estimator must adapt to change in RTT But not too fast, or too slow! Spurious timeouts Conservation of packets principle more than a window worth of packets in flight Initial Round-trip Estimator Round trip times exponentially averaged: New RTT = α (old RTT) + (1 - α) (new sample) Recommended value for α: 0.8-0.9 0.875 for most TCP s Retransmit timer set to β RTT, where β = 2 Every time timer expires, RTO exponentially backed-off Like Ethernet Not good at preventing spurious timeouts 31 32 Jacobson s Retransmission out Key observation: At high loads round trip variance is high Solution: Base RTO on RTT and standard deviation or RRTT rttvar = χ * dev + (1- χ)rttvar dev = linear deviation Inappropriately named actually smoothed linear deviation Retransmission Ambiguity Sample RTT A Original transmission RTO ACK retransmission B Sample RTT A B Original transmission RTO ACK retransmission 33 34 Karn s RTT Estimator Accounts for retransmission ambiguity If a segment has been retransmitted: Don t count RTT sample on ACKs for this segment Keep backed off time-out for next packet Reuse RTT estimate only after one successful transmission stamp Extension Used to improve timeout mechanism by more accurate measurement of RTT When sending a packet, insert current timestamp into option 4 bytes for seconds, 4 bytes for microseconds Receiver echoes timestamp in ACK Actually will echo whatever is in timestamp Removes retransmission ambiguity Can get RTT sample on any packet 35 36 6

r Granularity Many TCP implementations set RTO in multiples of 200,500,1000ms Why? Avoid spurious timeouts RTTs can vary quickly due to cross traffic Make timers interrupts efficient Overview TCP introduction TCP reliability: timer-driven TCP reliability: data-driven 37 38 TCP Flavors Tahoe, Reno, Vegas TCP Tahoe (distributed with 4.3BSD Unix) Original implementation of Van Jacobson s mechanisms (VJ paper) Includes: Slow start Congestion avoidance Fast retransmit Fast Retransmit What are duplicate acks (dupacks)? Repeated acks for the same sequence When can duplicate acks occur? Loss Packet re-ordering Window update advertisement of new flow control window Assume re-ordering is infrequent and not of large magnitude Use receipt of 3 or more duplicate acks as indication of loss Don t wait for timeout to retransmit packet 39 40 Fast Retransmit Multiple Losses Retransmission Duplicate Acks Now what? Retransmission Duplicate Acks 41 42 7

Tahoe TCP Reno (1990) All mechanisms in Tahoe Addition of fast-recovery Opening up congestion window after fast retransmit Delayed acks Header prediction Implementation designed to improve performance Has common case code inlined With multiple losses, Reno typically timeouts because it does not see duplicate acknowledgements 43 44 Reno NewReno Now what? timeout The ack that arrives after retransmission (partial ack) should indicate that a second loss occurred When does NewReno timeout? When there are fewer than three dupacks for first loss When partial ackis lost How fast does it recover losses? One per RTT 45 46 NewReno SACK Now what? partial ack recovery Basic problem is that cumulative acks only provide little information Ack for just the packet received What if acks are lost? carry cumulative also Not used Bitmask of packets received Selective acknowledgement (SACK) How to deal with reordering 47 48 8

SACK Performance Issues Now what? send retransmissions as soon as detected out >> fast rexmit Need 3 dupacks/sacks Not great for small transfers Don t have 3 packets outstanding What are real loss patterns like? Right edge recovery Allow packets to be sent on arrival of first and second duplicate ack Helps recovery for small windows How to deal with reordering? 49 50 TCP Extensions Implemented using TCP options stamp Protection from sequence number wraparound Large windows Protection From Wraparound Wraparound time vs. Link speed 1.5Mbps: 6.4 hours 10Mbps: 57 minutes 45Mbps: 13 minutes 100Mbps: 6 minutes 622Mbps: 55 seconds < MSL! 1.2Gbps: 28 seconds Use timestamp to distinguish sequence number wraparound 51 52 Large Windows Delay-bandwidth product for 100ms delay 1.5Mbps: 18KB 10Mbps: 122KB > max 16bit window 45Mbps: 549KB 100Mbps: 1.2MB 622Mbps: 7.4MB 1.2Gbps: 14.8MB Scaling factor on advertised window Specifies how many bits window must be shifted to the left Scaling factor exchanged during connection setup Maximum Segment Size (MSS) Exchanged at connection setup Typically pick MTU of local link What all does this effect? Efficiency Congestion control Retransmission Path MTU discovery Why should MTU match MSS? 53 54 9

Next Lecture: Congestion Control Congestion control basics TCP congestion control Assigned reading [JK88] Congestion Avoidance and Control [CJ89] Analysis of the Increase and Decrease Algorithms for Congestion Avoidance in Computer Networks 55 10