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

Similar documents
TCP Overview. Connection-oriented Byte-stream

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

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

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

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

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

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

Principles of congestion control

CS457 Transport Protocols. CS 457 Fall 2014

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

8. TCP Congestion Control

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

CE693 Advanced Computer Networks

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

Detecting half-open connections. Observed TCP problems

Transport Layer: Outline

05 Transmission Control Protocol (TCP)

User Datagram Protocol (UDP):

Congestion / Flow Control in TCP

15-744: Computer Networking TCP

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

CS4700/CS5700 Fundamentals of Computer Networks

Reliable Transport II: TCP and Congestion Control

Fall 2012: FCM 708 Bridge Foundation I

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

TCP : Fundamentals of Computer Networks Bill Nace

Lecture 4: Congestion Control

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

Transport Layer TCP / UDP

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

Transport Layer: outline

Congestion Avoidance and Control. Rohan Tabish and Zane Ma

Networked Systems and Services, Fall 2018 Chapter 3

Kent State University

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

ECE 333: Introduction to Communication Networks Fall 2001

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

Outline Computer Networking. Functionality Split. Transport Protocols

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

COMP/ELEC 429/556 Introduction to Computer Networks

Information Network 1 TCP 1/2. Youki Kadobayashi NAIST

Department of Computer and IT Engineering University of Kurdistan. Transport Layer. By: Dr. Alireza Abdollahpouri

Reliable Transport II: TCP and Congestion Control

Networked Systems and Services, Fall 2017 Reliability with TCP

image 3.8 KB Figure 1.6: Example Web Page

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

CSCI-1680 Transport Layer II Data over TCP Rodrigo Fonseca

Chapter 24. Transport-Layer Protocols

User Datagram Protocol

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

Reliable Transport I: Concepts and TCP Protocol

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

Intro to LAN/WAN. Transport Layer

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

CSCD 330 Network Programming

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

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

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

Transport Protocols and TCP

Good Ideas So Far Computer Networking. Outline. Sequence Numbers (reminder) TCP flow control. Congestion sources and collapse

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

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

CS 5520/ECE 5590NA: Network Architecture I Spring Lecture 13: UDP and TCP

Flow and Congestion Control Marcos Vieira

Introduction to Networks and the Internet

TSIN02 - Internetworking

Flow and Congestion Control (Hosts)

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

ETSF05/ETSF10 Internet Protocols Transport Layer Protocols

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

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

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

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

TCP: Flow and Error Control

Transport Protocols & TCP TCP

TCP/IP. Chapter 5: Transport Layer TCP/IP Protocols

Communication Networks

Computer Networking Introduction

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

Lecture 8. TCP/IP Transport Layer (2)

Lecture 3: The Transport Layer: UDP and TCP

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

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

Multiple unconnected networks

cs/ee 143 Communication Networks

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

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

SSFNET TCP Simulation Analysis by tcpanaly

TCP Congestion Control : Computer Networking. Introduction to TCP. Key Things You Should Know Already. Congestion Control RED

Topics. TCP sliding window protocol TCP PUSH flag TCP slow start Bulk data throughput

The Transport Layer: TCP & Reliable Data Transfer

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

Flow and Congestion Control

TCP congestion control:

CSCE 463/612 Networks and Distributed Processing Spring 2017

Reliable Byte-Stream (TCP)

Transport Layer Protocols TCP

Congestion Control. Brighten Godfrey CS 538 January Based in part on slides by Ion Stoica

Transcription:

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

Sources Fall and Stevens, TCP/IP Illustrated Vol. 1, 2nd edition Congestion Avoidance and Control, Jacobson and Karels, SIGCOMM 1988 2

Why is TCP needed? Can t we send everything on top of IP? No reordering, restransmission, etc. Applications care about sending data, not packets Most of the time, the appropriate abstraction is a pipe between sender and receiver TCP provides that pipe Also, TCP ensures that available bandwidth is used while striving to prevent congestion 3

Introduction to TCP Communication abstraction: Reliable Ordered Point-to-point Byte-stream Protocol implemented entirely at the ends Assumes unreliable, non-sequenced delivery Fate sharing 4

TCP Reliability Mechanism Sender data ack 1 2 3 lost ack Receiver 2 5

TCP Header Source port Destination port Flags: SYN FIN RESET PUSH URG ACK Sequence number Acknowledgement Hdr len 0 Flags Advertised window Checksum Urgent pointer Options (variable) Data 6

TCP Mechanisms Connection establishment Sequence number selection Connection tear-down Round-trip estimation Window flow control 7

Connection Establishment A and B must agree on initial sequence number selection: Use 3-way handshake A B A B Aseqn Bseqn SYN SYN+ACK-A ACK ACK-B 8

Connection Setup 9

Sequence Number Selection Initial sequence number (ISN) selection Why not simply chose 0? Must avoid overlap with earlier incarnation Requirements for ISN selection Must operate correctly Without synchronized clocks Despite node failures Must not be trivially predictable (now it is assumed; 15 years ago, not so much) 10

ISN and Quiet Time Assume upper bound on segment lifetime (MSL) In TCP, this is 2 minutes Upon startup, cannot assign sequence numbers for MSL seconds Can still have sequence number overlap (wraparound) If sequence number space not large enough for highbandwidth connections Sequence numbers are 32-bit long: must send >= 4GB data in <= 2 minutes for wraparound 11

Connection Tear-down Normal termination Allow unilateral close Avoid sequence number overlap TCP must continue to receive data even after closing Cannot close connection immediately: what if a new connection restarts and uses same sequence number? 12

Tear-down Packet Exchange Sender FIN FIN-ACK Receiver Data write Data ack FIN FIN-ACK 13

Connection Tear-down 14

Round-trip Time 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! 15

Early Round-trip Estimator Round trip times exponentially averaged: New RTT = α (old RTT) + (1 - α) (new sample) Recommended value for α: 0.8-0.9 Retransmit timer set to β*rtt, where β = 2 Every time timer expires, RTO exponentially backedoff Typically RTO is not allowed to exceed a maximum threshold (Linux: TCP_RTO_MAX; default 120s) 16

Retransmission Ambiguity A B A B Original transmission Original transmission Sample RTT RTO retransmission ACK Sample RTT RTO ACK retransmission Suppose RTO expires, segment is retransmitted, and then an ACK is received Is the ACK referring to the original transmission, or to the retransmission? 17

Karn s Retransmission Timeout 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 18

Jacobson s Retransmission Timeout Estimator Key observation: Using β RTT for timeout doesn t work At high loads round trip variance is high Solution: If D denotes mean variation Timeout = RTT + 4D 19

Flow Control Problem: Fast sender can overrun receiver Packet loss, unnecessary retransmissions Possible solutions: Sender transmits at pre-negotiated rate Sender limited to a window s worth of unacknowledged data Flow control different from congestion control 20

Window Flow Control: Send window Sent but not acked Not yet sent Sequence numbers Next to be sent 21

Window Flow Control: Receive Receive buffer Acked but not delivered to user Not yet acked Sequence numbers Gap window The receiving TCP may be forced to hold on to data with larger sequence numbers before giving it to an application until a missing lower-sequence-numbered segment ( a hole ) is filled in 22

Window Advancement Issues Advancing a full window When the receive window fills up, how do things get started again? Sender sends periodic probe while receive win is 0 Silly window syndrome Fast sender, slow receiver Delayed acks at receiver help, but not a full solution 23

Nagle s algorithm In the Internet s early days, a lot of traffic consisted of interactive terminal sessions Sending one packet per keypress generates a lot of overhead! TCP/IP headers + data: ~88 bytes for 1 byte of data In most cases, multiple keypresses can be aggregated in a single packet with no perceivable degradation of responsiveness Nagle s algorithm: Delay sending if un-acked data in flight Overwrite with TCP-NODELAY option 24

TCP Congestion Control 25

Congestion 10 Mbps 100 Mbps 1.5 Mbps Chokepoint! Caused by fast links feeding into slow link Severe congestion may lead to network collapse Flows send full windows, but progress is very slow Most packets in the network are retransmissions Other causes of congestion collapse Non-feedback controlled sources 26

Congestion Control and Avoidance Requirements Uses network resources efficiently Preserves fair network resource allocation Prevents or avoids collapse Congestion collapse is not just a theory Has been frequently observed in many networks Example: (from Jacobson & Karels): in October 86, the link between LBL and UC- Berkeley experienced a ~800X throughput decrease 27

Congestion Response throughput delay knee load load 28

Congestion Control Design Avoidance or control? Need both! Avoidance keeps system at knee of curve But, to do that, need routers to send accurate signals (some feedback) Control is necessary when things go bad Sending host must adjust amount of data it puts in the network based on detected congestion TCP uses its window to do this But what s the right strategy to increase/decrease window? 29

TCP Congestion Control A collection of interrelated mechanisms: Slow start Congestion avoidance Accurate retransmission timeout estimation Fast retransmit Fast recovery 30

Congestion Control Underlying design principle: Packet Conservation At equilibrium, inject packet into network only when one is removed Basis for stability of physical systems 31

TCP Congestion Control Basics Keep a congestion window, cwnd Denotes how much network is able to absorb Sender s maximum window: Min (advertised window, cwnd) Sender s actual window: Max window - unacknowledged segments 32

Clocking Packets Suppose we have large actual window. How do we send data? In one shot? No, this violates the packet conservation principle Solution: use acks to clock sending new data Ack reception means at least one packet was removed from the network 33

TCP is Self-clocking Pb P r sender receiver A s A b A r 34

Slow Start But how do we get this clocking behavior to start? Initialize cwnd = 1 Upon receipt of every ack, cwnd = cwnd + 1 Implications Window doubles on every RTT Multiplicative increase! Can overshoot window and cause packet loss 35

Slow Start Example 0R 1 one pkt time one RTT 1R 2R 3R 1 2 3 2 3 4 5 8 9 6 7 4 5 6 7 10 11 12 13 14 15 36

Data (KB) Slow Start Sequence Plot Slow start time 37

Jacobson, Figure 3: No Slow Start 38

Jacobson, Figure 4: with Slow Start 39

Congestion Avoidance Coarse grained timeout as loss indicator Suppose loss occurs when cwnd = W Network can absorb 0.5W ~ W segments Conservatively set cwnd to 0.5W (multiplicative decrease) Avoid exponential queue buildup Upon receiving ACK Increase cwnd by 1/cwnd (additive increase) Multiplicative increase -> non-convergence 40

Slow Start and Congestion Avoidance If packet is lost we lose our self clocking as well timeout has caused link to go quiet Need to implement slow-start and congestion avoidance together New variable: ssthresh (slow-start threshold) When timeout occurs set ssthresh to 0.5W If cwnd < ssthresh, use slow start Else use congestion avoidance 41

Jacobson, Figure 8: 4x no Congestion avoidance 42

Jacobson, Figure 9: 4 TCPs with Congestion Avoidance 43