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

Similar documents
TCP Service Model. Announcements. TCP: Reliable, In-Order Delivery. Today s Lecture. TCP Support for Reliable Delivery. TCP Header

CS457 Transport Protocols. CS 457 Fall 2014

EE 122: Transport Protocols: UDP and TCP

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

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

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

Page 1. Goals for Today" Placing Network Functionality" Basic Observation" CS162 Operating Systems and Systems Programming Lecture 15

Communication Networks

CSCD 330 Network Programming

Communication Networks

TCP Performance. EE 122: Intro to Communication Networks. Fall 2006 (MW 4-5:30 in Donner 155) Vern Paxson TAs: Dilip Antony Joseph and Sukun Kim

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

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

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

05 Transmission Control Protocol (TCP)

CS4700/CS5700 Fundamentals of Computer Networks

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

Transmission Control Protocol (TCP)

COMPUTER NETWORKS CS CS 55201

COMPUTER NETWORKS CS CS 55201

Transport Protocols & TCP TCP

COMP/ELEC 429/556 Introduction to Computer Networks

User Datagram Protocol

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

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

Transport Layer: Outline

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

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

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

Flow and Congestion Control

EE 122: IP Forwarding and Transport Protocols

CS 43: Computer Networks. 18: Transmission Control Protocol October 12-29, 2018

Transport Layer: outline

CS419: Computer Networks. Lecture 10, Part 3: Apr 13, 2005 Transport: TCP performance

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

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

Multiple unconnected networks

Transport Layer Marcos Vieira

Congestion / Flow Control in TCP

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

ICS 451: Today's plan. Sliding Window Reliable Transmission Acknowledgements Windows and Bandwidth-Delay Product Retransmission Timers Connections

32 bits. source port # dest port # sequence number acknowledgement number not used. checksum. Options (variable length)

ECE 435 Network Engineering Lecture 9

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

User Datagram Protocol (UDP):

CSC 401 Data and Computer Communications Networks

CS118 Discussion 1A, Week 4. Zengwen Yuan Dodd Hall 78, Friday 10:00 11:50 a.m.

Networking Technologies and Applications

Lecture 08: The Transport Layer (Part 2) The Transport Layer Protocol (TCP) Dr. Anis Koubaa

TCP. TCP: Overview. TCP Segment Structure. Maximum Segment Size (MSS) Computer Networks 10/19/2009. CSC 257/457 - Fall

Transport Protocols and TCP

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

TCP : Fundamentals of Computer Networks Bill Nace

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

TCP. 1 Administrivia. Tom Kelliher, CS 325. Apr. 2, Announcements. Assignment. Read From Last Time

TCP Overview. Connection-oriented Byte-stream

Page 1. Goals for Today" Discussion" Example: Reliable File Transfer" CS162 Operating Systems and Systems Programming Lecture 11

Networked Systems and Services, Fall 2017 Reliability with TCP

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

COMP 431 Internet Services & Protocols. Transport Layer Protocols & Services Outline. The Transport Layer Reliable data delivery & flow control in TCP

Transport Protocols and TCP: Review

ECE 333: Introduction to Communication Networks Fall 2001

Communications Software. CSE 123b. CSE 123b. Spring Lecture 3: Reliable Communications. Stefan Savage. Some slides couresty David Wetherall

Fall 2012: FCM 708 Bridge Foundation I

Kent State University

Reliable Transport I: Concepts and TCP Protocol

Networked Systems and Services, Fall 2018 Chapter 3

Sequence Number. Acknowledgment Number. Data

CSCE 463/612 Networks and Distributed Processing Spring 2017

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

Reliable Transport I: Concepts and TCP Protocol

TCP = Transmission Control Protocol Connection-oriented protocol Provides a reliable unicast end-to-end byte stream over an unreliable internetwork.

Reliable Byte-Stream (TCP)

CSC 4900 Computer Networks: TCP

Computer Communication Networks Midterm Review

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

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

Transport Protocols. Raj Jain. Washington University in St. Louis

10 minutes survey (anonymous)

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

Recap. More TCP. Congestion avoidance. TCP timers. TCP lifeline. Application Presentation Session Transport Network Data Link Physical

Chapter 3 Transport Layer

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

The Transport Layer Reliable data delivery & flow control in TCP. Transport Layer Protocols & Services Outline

ECE 650 Systems Programming & Engineering. Spring 2018

Fundamentals of Computer Networks ECE 478/578. Transport Layer. End- to- End Protocols 4/16/13. Spring Application. Application.

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

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

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

Announcements. IP Forwarding & Transport Protocols. Goals of Today s Lecture. Are 32-bit Addresses Enough? Summary of IP Addressing.

The Transport Layer Reliable data delivery & flow control in TCP. Transport Layer Protocols & Services Outline

Computer Networking Introduction

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

Chapter III: Transport Layer

Lecture 5. Transport Layer. Transport Layer 1-1

Goals for Today s Lecture

Chapter 3 Transport Layer

Introduction to Networks and the Internet

Unit 2.

Transcription:

Today s Lecture How does TCP achieve correct operation? EE 122:TCP, Connection Setup, Reliability Ion Stoica TAs: Junda Liu, DK Moon, David Zats Reliability in the face of IP s best effort service 3-way handshake to establish connections 3-way or 4-way handshake to terminate connections Retransmission to recover from loss http://inst.eecs.berkeley.edu/~ee122/ (Materials with thanks to Vern Paxson, Jennifer Rexford, and colleagues at UC Berkeley) 1 We ll only look at timeout-based retransmission today 2 TCP Service Model TCP Support for Reliable Delivery Reliable, in-order, byte-stream delivery and with good performance Challenges - the network can drop packets delay packets deliver packets out-of-order replicate packets Weird, but it does sometimes happen corrupt packets Checksum Used to detect corrupted data at the receiver leading the receiver to drop the packet s Used to detect missing data... and for putting the data back in order Retransmission Sender retransmits lost or corrupted data based on estimates of round-trip time Fast retransmit algorithm for rapid retransmission 3 4 1

These should be familiar 5 6 Starting sequence number (byte offset) of data carried in this segment gives seq # just beyond highest seq. received in order. E.g., if sender sends N in-order bytes starting at seq S then ack for it will be S+N. 7 8 2

Number of 4-byte words in TCP header; 5 = no options Must Be Zero 6 bits reserved 9 10 We will get to these shortly Buffer space available for receiving data. Used for TCP s sliding window. Interpreted as offset beyond field s value. 11 12 3

Byte 80 Byte 3 Byte 2 Byte 1 Byte 0 Byte 80 Byte 3 Byte 2 Byte 1 Byte 0 Byte 80 Byte 3 Byte 2 Byte 1 Byte 0 Byte 80 Byte 3 Byte 2 Byte 1 Byte 0 TCP Stream of Bytes Service Host A Used with URG flag to indicate urgent data (not discussed further) Host B 13 14 Provided Using TCP Segments TCP Segment Host A IP TCP (segment) TCP Hdr IP Hdr Host B TCP TCP Segment sent when: 1. Segment full (Max Segment Size), 2. Not full, but times out, or 3. Pushed by application. 15 IP packet No bigger than Maximum Transmission Unit (MTU) E.g., up to 1,500 bytes on an Ethernet TCP packet IP packet with a TCP header and data inside TCP header 20 bytes long (IP Header = 20 bytes) TCP segment No more than Maximum Segment Size (MSS) bytes E.g., up to 1460 consecutive bytes from the stream 16 4

Sequence Numbers Host A Sequence number = 1 st byte Host B ISN (initial sequence number) TCP TCP HDR TCP TCP HDR sequence number = next expected byte Initial Sequence Number (ISN) for the very first byte E.g., Why not just use ISN = 0? Practical issue IP addresses and port #s uniquely identify a connection Eventually, though, these port #s do get used again there is a chance an old packet is still in flight and might be associated with new connection TCP requires (RFC793) changing ISN over time Set from 32-bit clock that ticks every 4 microseconds only wraps around once every 4.55 hours To establish a connection, hosts exchange ISNs 17 18 Timing Diagram: 3-Way Handshaking Connection Establishment: TCP s Three-Way Handshake Active Open Client (initiator) connect()! SYN, SeqNum = x Passive Open Server listen()! SYN +, SeqNum = y, Ack = x + 1, Ack = y + 1 accept()! 19 20 5

What if the SYN Gets Lost? Flags: SYN FIN RST PSH URG HdrLen 0 Checksum Flags See /usr/include/netinet/tcp.h on Unix Systems Advertised window Urgent pointer 21 Suppose the SYN packet gets lost is lost inside the network, or: Server discards the packet (e.g., listen queue is full) Eventually, no SYN- arrives Sender sets a timer and waits for the SYN- and retransmits the SYN if needed How should the TCP sender set the timer? Sender has no idea how far away the receiver is Hard to guess a reasonable length of time to wait SHOULD (RFCs 1122 & 2988) use default of 3 seconds Other implementations instead use 6 seconds 22 Tearing Down (Close) the Connection Close Connection (Two-Army Problem) Goal: both sides agree to close the connection Two-army problem: Two blue armies need to simultaneously attack the white army to win; otherwise they will be defeated. The blue army can communicate only across the area controlled by the white army which can intercept the messengers. 23 What is the solution? 24 6

Normal Termination, One Side (A) Normal Termination, Both Together B B SYN SYN FIN FIN SYN SYN FIN FIN + A Finish (FIN) to close and receive remaining bytes FIN occupies one byte in the sequence space Other host ack s the byte to confirm Closes A s side of the connection, but not B s time Until B likewise sends a FIN Which A then acks Connection now half-closed : Avoid reincarnation Can retransmit FIN if lost Connection now closed 25 A time : Avoid reincarnation Can retransmit FIN if lost Connection now closed Same as before, but B sets FIN with their ack of A s FIN 26 Abrupt Termination B SYN SYN RST RST A time Reliability: TCP Retransmission A sends a RESET (RST) to B E.g., because app. process on A crashed That s it B does not ack the RST Thus, RST is not delivered reliably And: any data in flight is lost But: if B sends anything more, will elicit another RST 27 28 7

Reasons for Retransmission How Long Should Sender Wait? lost lost DUPLICATE PET Early timeout DUPLICATE 29 PETS Sender sets a timeout to wait for an Too short: wasted retransmissions Too long: excessive delays when packet lost TCP sets retransmission timeout (RTO) as function of RTT Expect to arrive an RTT after data sent plus slop to allow for variations (e.g., queuing, MAC) But: how does the sender know the RTT? And: what s a good estimate for slop? 30 RTT Estimation Use exponential averaging: EstimatedRTT SampleRTT = AckRcvdTime SendTime EstimatedRTT = α EstimatedRTT + (1 α) SampleRTT α = 7/8 (for one measurement per flight) SampleRTT Time 31 Jacobson/Karels Algorithm Compute slop in terms of observed variability One solution: use standard deviation (requires expensive square root computation) Use mean deviation instead Difference = SampleRTT EstimatedRTT Deviation = Deviation +δ ( Difference Deviation) RTO = µ EstimatedRTT + φ Deviation δ =1/4 (again, for one measurement per flight) µ =1 φ = 4 Implementations often use a coarse-grained (500 msec) 32 timer, so resulting value is large 8

Problem: Ambiguous Measurement How to differentiate between the real, and of the retransmitted packet? SampleRTT? Sender Original Transmission Retransmission Receiver SampleRTT? Sender Original Transmission Retransmission Receiver Karn/Partridge Algorithm Measure SampleRTT only for original transmissions Once a segment has been retransmitted, do not use it for any further measurements Also, employ exponential backoff Every time RTO timer expires, set RTO 2 RTO (Up to maximum 60 sec) Every time new measurement comes in (= successful original transmission), collapse RTO back to computed value 33 34 Summary Reliable, in-order, byte-stream delivery s s 3-way handshake to establish 3-way or 4-way handshake to terminate Timer-based retransmission What s missing? Performance 35 9