TCP Review. Carey Williamson Department of Computer Science University of Calgary Winter 2018

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

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

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

Chapter 3- parte B outline

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

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

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

CNT 6885 Network Review on Transport Layer

Correcting mistakes. TCP: Overview RFCs: 793, 1122, 1323, 2018, TCP seq. # s and ACKs. GBN in action. TCP segment structure

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

COMP/ELEC 429/556 Introduction to Computer Networks

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

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, steam: r Development of reliable protocol r Sliding window protocols

CS 43: Computer Networks. 19: TCP Flow and Congestion Control October 31, Nov 2, 2018

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581

User Datagram Protocol

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

Transmission Control Protocol

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, Development of reliable protocol Sliding window protocols

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

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

Chapter 24. Transport-Layer Protocols

Lecture 3 The Transport Control Protocol (TCP) Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

Fall 2012: FCM 708 Bridge Foundation I

TCP Congestion Control

TCP Congestion Control

Chapter III: Transport Layer

CSC 401 Data and Computer Communications Networks

Transport Layer: outline

Lecture 8. TCP/IP Transport Layer (2)

CS321: Computer Networks Congestion Control in TCP

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

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

The Transport Layer: TCP & Reliable Data Transfer

Transport Layer: Outline

Intro to LAN/WAN. Transport Layer

Information Network 1 TCP 1/2. Youki Kadobayashi NAIST

Outline. CS5984 Mobile Computing

Lecture 22: TCP & NAT. CSE 123: Computer Networks Alex C. Snoeren

Page 1. Review: Internet Protocol Stack. Transport Layer Services EEC173B/ECS152C. Review: TCP. Transport Layer: Connectionless Service

Chapter 3 Transport Layer

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

Page 1. Review: Internet Protocol Stack. Transport Layer Services. Design Issue EEC173B/ECS152C. Review: TCP

Transport Protocols & TCP TCP

Multiple unconnected networks

Outline Computer Networking. Functionality Split. Transport Protocols

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

ECE 435 Network Engineering Lecture 10

image 3.8 KB Figure 1.6: Example Web Page

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

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

Transport Protocols and TCP: Review

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

Internet Networking recitation #10 TCP New Reno Vs. Reno

Transport Protocols and TCP

UNIT IV -- TRANSPORT LAYER

Computer Networking Introduction

Congestion Control End Hosts. CSE 561 Lecture 7, Spring David Wetherall. How fast should the sender transmit data?

Chapter 3 Transport Layer

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

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

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

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

Recap. TCP connection setup/teardown Sliding window, flow control Retransmission timeouts Fairness, max-min fairness AIMD achieves max-min fairness

Chapter III: Transport Layer

CC451 Computer Networks

10 minutes survey (anonymous)

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

Lecture 3: The Transport Layer: UDP and TCP

Transport protocols. Transport Layer 3-1

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

CSCE 463/612 Networks and Distributed Processing Spring 2017

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

cs/ee 143 Communication Networks

Computer Networking Introduction

Transport Layer Marcos Vieira

CSCD 330 Network Programming

Lecture 4: Congestion Control

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

CSCD 330 Network Programming Winter 2015

TCP Overview. Connection-oriented Byte-stream

User Datagram Protocol (UDP):

TCP congestion control:

TCP (Part 2) Session 10 INST 346 Technologies, Infrastructure and Architecture

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

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

TCP: Overview RFCs: 793,1122,1323, 2018, 2581

RSC Part III: Transport Layer 3. TCP

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

Internet Protocols Fall Outline

05 Transmission Control Protocol (TCP)

TCP reliable data transfer. Chapter 3 outline. TCP sender events: TCP sender (simplified) TCP: retransmission scenarios. TCP: retransmission scenarios

TCP : Fundamentals of Computer Networks Bill Nace

TCP based Receiver Assistant Congestion Control

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

CS4700/CS5700 Fundamentals of Computer Networks

Congestion / Flow Control in TCP

CS4700/CS5700 Fundamentals of Computer Networks

ETSF05/ETSF10 Internet Protocols Transport Layer Protocols

CS3600 SYSTEMS AND NETWORKS

Transcription:

TCP Review Carey Williamson Department of Computer Science University of Calgary Winter 2018 Credit: Much of this content came courtesy of Erich Nahum (IBM Research)

The TCP Protocol Connection-oriented, point-to-point protocol: Connection establishment and teardown phases Phone-like circuit abstraction (application-layer view) One sender, one receiver Called a reliable byte stream protocol General purpose (for any network environment) Originally optimized for certain kinds of transfer: Telnet (interactive remote login) FTP (long, slow transfers) Web is like neither of these! 2

TCP Protocol (cont d) socket layer application writes data TCP send buffer data segment ACK segment application reads data TCP receive buffer Provides a reliable, in-order, byte stream abstraction: Recover lost packets and detect/drop duplicates Detect and drop corrupted packets Preserve order in byte stream, no message boundaries Full-duplex: bi-directional data flow in same connection Flow and congestion control: Flow control: sender will not overwhelm receiver Congestion control: sender will not overwhelm the network Sliding window flow control Send and receive buffers Congestion control done via adaptive flow control window size socket layer 3

The TCP Header Fields enable the following: Uniquely identifying each TCP connection (4-tuple: client IP and port, server IP and port) Identifying a byte range within that connection Checksum value to detect corruption Flags to identify protocol state transitions (SYN, FIN, RST) Informing other side of your state (ACK) 32 bits source port # dest port # sequence number head len acknowledgement number not used UAP RSF checksum rcvr window size ptr urgent data Options (variable length) application data (variable length) 4

Establishing a TCP Connection Client sends SYN with initial sequence number (ISN = X) Server responds with its own SYN w/seq number Y and ACK of client ISN with X+1 (next expected byte) connect() client server listen() port 80 Client ACKs server's ISN with Y+1 The 3-way handshake X, Y randomly chosen All modulo 32-bit arithmetic time accept() read() 5

Sending Data socket layer application writes data TCP send buffer data segment ACK segment application reads data TCP receive buffer socket layer Sender TCP passes segments to IP to transmit: Keeps a copy in buffer at send side in case of loss Called a reliable byte stream protocol Sender must obey receiver advertised window Receiver sends acknowledgments (ACKs) ACKs can be piggybacked on data going the other way Protocol allows receiver to ACK every other packet in attempt to reduce ACK traffic (delayed ACKs) Delay should not be more than 500 ms (typically 200 ms) We ll later see how this causes a few problems 6

Preventing Congestion Sender may not only overrun receiver, but may also overrun intermediate routers: No way to explicitly know router buffer occupancy, so we need to infer it from packet losses Assumption is that losses stem from congestion in the network (i.e., an intermediate router has no more buffers available) Sender maintains a congestion window (called cwnd or CW) Never have more than CW of un-acknowledged data outstanding (or RWIN data; min of the two) Successive ACKs from receiver cause CW to grow. How CW grows depends on which of 2 phases TCP is in: Slow-start: initial state. Grows CW quickly (exponentially). Congestion avoidance: steady-state. Grows CW slowly (linearly). Switch between the two when CW > slow-start threshold 7

Congestion Control Principles Lack of congestion control would lead to congestion collapse (Jacobson 88). Idea is to be a good network citizen. Would like to transmit as fast as possible without loss. Probe network to find available bandwidth. In steady-state: linear increase in CW per RTT. After loss event: CW is halved. This general approach is called Additive Increase and Multiplicative Decrease (AIMD). Various papers on why AIMD leads to network stability. 8

RTT Slow Start Initial CW = 1. After each ACK, CW += 1; Continue until: Loss occurs OR CW > slow start threshold Then switch to congestion avoidance If we detect loss, cut CW in half Exponential increase in window size per RTT sender receiver time 9

Congestion Avoidance Until (loss) { after CW packets ACKed: CW += 1; } ssthresh = CW/2; Depending on loss type: SACK/Fast Retransmit: CW/= 2; continue; Course grained timeout: CW = 1; go to slow start. (This is for TCP Reno/SACK: TCP Tahoe always sets CW=1 after a loss) 10

timeout How are losses recovered? What if packet is lost (data or ACK!) Coarse-grained Timeout: Sender does not receive ACK after some period of time Event is called a retransmission timeout (RTO) RTO value is based on estimated round-trip time (RTT) RTT is adjusted over time using exponential weighted moving average: RTT = (1-x)*RTT + (x)*sample (x is typically 0.1) First done in TCP Tahoe sender receiver X loss lost ACK scenario time 11

Fast Retransmit Receiver expects N, gets N+1: Immediately sends ACK(N) This is called a duplicate ACK Does NOT delay ACKs here! Continue sending dup ACKs for each subsequent packet (not N) Sender gets 3 duplicate ACKs: Infers N is lost and resends 3 chosen so out-of-order packets don t trigger Fast Retransmit accidentally Called fast since we don t need to wait for a full RTT sender receiver X Introduced in TCP Reno time 12

Other Loss Recovery Methods Selective Acknowledgements (SACK): Returned ACKs contain option w/sack block Block says, "got up N-1 AND got N+1 through N+3" A single ACK can generate a retransmission New Reno partial ACKs: New ACK during fast retransmit may not ACK all outstanding data. Ex: Have ACK of 1, waiting for 2-6, get 3 dup acks of 1 Retransmit 2, get ACK of 3, can now infer 4 lost as well Other schemes exist (e.g., Vegas) Reno has been prevalent; SACK now catching on 13

timed wait Connection Termination Either side may terminate a connection. ( In fact, connection can stay half-closed.) Let's say the server closes (typical in WWW) client server close() Server sends FIN with seq Number (SN+1) (i.e., FIN is a byte in sequence) close() Client ACK's the FIN with SN+2 ("next expected") Client sends it's own FIN when ready time Server ACK's client FIN as well with SN+1. closed 14

The TCP State Machine TCP uses a Finite State Machine, kept by each side of a connection, to keep track of what state a connection is in. State transitions reflect inherent races that can happen in the network, e.g., two FIN's passing each other in the network. Certain things can go wrong along the way, i.e., packets can be dropped or corrupted. In fact, machine is not perfect; certain problems can arise not anticipated in the original RFC. This is where timers will come in, which we will discuss more later. 15

TCP Connection Establishment CLOSED: more implied than actual, i.e., no connection LISTEN: willing to receive connections (accept call) SYN-SENT: sent a SYN, waiting for SYN-ACK SYN-RECEIVED: received a SYN, waiting for an ACK of our SYN ESTABLISHED: connection ready for data transfer server application calls listen() LISTEN receive SYN send SYN + ACK SYN_RCVD CLOSED receive SYN send ACK client application calls connect() send SYN SYN_SENT receive SYN & ACK send ACK receive ACK ESTABLISHED 16

TCP Connection Termination FIN-WAIT-1: we closed first, waiting for ACK of our FIN (active close) FIN-WAIT-2: we closed first, other side has ACKED our FIN, but not yet FIN'ed CLOSING: other side closed before it received our FIN TIME-WAIT: we closed, other side closed, got ACK of our FIN CLOSE-WAIT: other side sent FIN first, not us (passive close) LAST-ACK: other side sent FIN, then we did, now waiting for ACK FIN_WAIT_2 FIN_WAIT_1 receive ACK of FIN receive FIN send ACK close() called send FIN TIME_WAIT wait 2*MSL (240 seconds) ESTABLISHED receive FIN send ACK CLOSING receive ACK of FIN receive FIN send ACK CLOSE_WAIT close() called send FIN LAST_ACK receive ACK CLOSED 17

Summary: TCP Protocol Protocol provides reliability in face of complex network behavior Tries to trade off efficiency with being "good network citizen (i.e., fairness) Vast majority of bytes transferred on Internet today are TCP-based: Web Email News Peer-to-peer (Napster, Gnutella, FreeNet, KaZaa) Some video streaming applications (YouTube) 18