Lecture 7. TCP mechanisms for:

Similar documents
Transport Layer Protocols

B-2 Analyzing TCP/IP Networks with Wireshark. Ray Tompkins Founder of Gearbit

Computer Networks. Chapter 5 Transport Protocols

Computer Networks UDP and TCP

TCP Flow Control. TCP Receiver Window. Sliding Window. Computer Networks. Lecture 30: Flow Control, Reliable Delivery

TCP in Wireless Mobile Networks

TCP over Multi-hop Wireless Networks * Overview of Transmission Control Protocol / Internet Protocol (TCP/IP) Internet Protocol (IP)

Outline. TCP connection setup/data transfer Computer Networking. TCP Reliability. Congestion sources and collapse. Congestion control basics

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

Higher Layer Protocols: UDP, TCP, ATM, MPLS

La couche transport dans l'internet (la suite TCP/IP)

La couche transport dans l'internet (la suite TCP/IP)

First Midterm for ECE374 03/09/12 Solution!!

TCP/IP Optimization for Wide Area Storage Networks. Dr. Joseph L White Juniper Networks

COMP 3331/9331: Computer Networks and Applications. Lab Exercise 3: TCP and UDP (Solutions)

Final for ECE374 05/06/13 Solution!!

[Prof. Rupesh G Vaishnav] Page 1

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

Access Control: Firewalls (1)

Computer Networks. Data Link Layer

First Midterm for ECE374 03/24/11 Solution!!

This sequence diagram was generated with EventStudio System Designer (

Application Level Congestion Control Enhancements in High BDP Networks. Anupama Sundaresan

TCP and Wireless Networks Classical Approaches Optimizations TCP for 2.5G/3G Systems. Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme

Visualizations and Correlations in Troubleshooting

Chapter 5. Transport layer protocols

Low-rate TCP-targeted Denial of Service Attack Defense

High Speed Internet Access Using Satellite-Based DVB Networks

q Connection establishment (if connection-oriented) q Data transfer q Connection release (if conn-oriented) q Addressing the transport user

Prefix AggregaNon. Company X and Company Y connect to the same ISP, and they are assigned the prefixes:

Transport Layer. Chapter 3.4. Think about

Improving the Performance of TCP Using Window Adjustment Procedure and Bandwidth Estimation

TCP/IP Networking for Wireless Systems. Integrated Communication Systems Group Ilmenau University of Technology

A Transport Protocol for Multimedia Wireless Sensor Networks

Mobile Communications Chapter 9: Mobile Transport Layer

APPENDIX 1 USER LEVEL IMPLEMENTATION OF PPATPAN IN LINUX SYSTEM

Chapter 6 Congestion Control and Resource Allocation

Lecture 15: Congestion Control. CSE 123: Computer Networks Stefan Savage

Data Networks Summer 2007 Homework #3

Lecture Objectives. Lecture 07 Mobile Networks: TCP in Wireless Networks. Agenda. TCP Flow Control. Flow Control Can Limit Throughput (1)

TCP Adaptation for MPI on Long-and-Fat Networks

What is a DoS attack?

IP address format: Dotted decimal notation:

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

Multipath TCP in Practice (Work in Progress) Mark Handley Damon Wischik Costin Raiciu Alan Ford

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Ethernet. Ethernet Frame Structure. Ethernet Frame Structure (more) Ethernet: uses CSMA/CD

TCP Performance Management for Dummies

TFTP TRIVIAL FILE TRANSFER PROTOCOL OVERVIEW OF TFTP, A VERY SIMPLE FILE TRANSFER PROTOCOL FOR SIMPLE AND CONSTRAINED DEVICES

Ethernet. Ethernet. Network Devices

Lecture Computer Networks

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Pig Laboratory. Additional documentation for the laboratory. Exercises and Rules. Tstat Data

TCP for Wireless Networks

Mike Canney Principal Network Analyst getpackets.com

The Problem with TCP. Overcoming TCP s Drawbacks

Improving Effective WAN Throughput for Large Data Flows By Peter Sevcik and Rebecca Wetzel November 2008

Mobile Computing/ Mobile Networks

Congestion Control Review Computer Networking. Resource Management Approaches. Traffic and Resource Management. What is congestion control?

Indian Institute of Technology Kharagpur. TCP/IP Part I. Prof Indranil Sengupta Computer Science and Engineering Indian Institute of Technology

TCP/IP Inside the Data Center and Beyond. Dr. Joseph L White, Juniper Networks

CS268 Exam Solutions. 1) End-to-End (20 pts)

Frequently Asked Questions

Applications. Network Application Performance Analysis. Laboratory. Objective. Overview

Networking Overview. (as usual, thanks to Dave Wagner and Vern Paxson)

TCP over Wireless Networks

Network Programming TDC 561

Transport layer protocols for ad hoc networks

Solution of Exercise Sheet 5

CSMA/CA. Information Networks p. 1

CHAPTER 1 PRINCIPLES OF NETWORK MONITORING

Data Link Layer(1) Principal service: Transferring data from the network layer of the source machine to the one of the destination machine

CSE 473 Introduction to Computer Networks. Exam 2 Solutions. Your name: 10/31/2013

TCP in Wireless Networks

D. SamKnows Methodology 20 Each deployed Whitebox performs the following tests: Primary measure(s)

A Resilient Transport Layer for Messaging Systems

How do I get to

CMPE 150 Winter 2009

Challenges of Sending Large Files Over Public Internet

What is CSG150 about? Fundamentals of Computer Networking. Course Outline. Lecture 1 Outline. Guevara Noubir noubir@ccs.neu.

MODBUS MESSAGING ON TCP/IP IMPLEMENTATION GUIDE V1.0b CONTENTS

Advanced Computer Networks Project 2: File Transfer Application

First Midterm for ECE374 02/25/15 Solution!!

CSE331: Introduction to Networks and Security. Lecture 9 Fall 2006

IP - The Internet Protocol

Effect of Packet-Size over Network Performance

STANDPOINT FOR QUALITY-OF-SERVICE MEASUREMENT

TOE2-IP FTP Server Demo Reference Design Manual Rev1.0 9-Jan-15

Servicesin ns-3. Outline SIMULACIÓN DE PROTOCOLOS DE ENRUTAMIENTO PARA REDES MÓVILES AD-HOC MEDIANTE HERRRAMIENTA DE SIMULACIÓN NS-3

Stop And Wait. ACK received; transmit frame 2 CS 455 3

Web Servers Should Turn Off Nagle to Avoid Unnecessary 200 ms Delays +

Final Exam. Route Computation: One reason why link state routing is preferable to distance vector style routing.

TCP Window Size for WWAN Jim Panian Qualcomm

Network Security TCP/IP Refresher

Note! The problem set consists of two parts: Part I: The problem specifications pages Part II: The answer pages

Data Link Layer. Flow Control. Flow Control

TCP Offload Engines. As network interconnect speeds advance to Gigabit. Introduction to

Network-Oriented Software Development. Course: CSc4360/CSc6360 Instructor: Dr. Beyah Sessions: M-W, 3:00 4:40pm Lecture 2

Basic Networking Concepts. 1. Introduction 2. Protocols 3. Protocol Layers 4. Network Interconnection/Internet

Simulation-Based Comparisons of Solutions for TCP Packet Reordering in Wireless Network

Transcription:

Lecture 7. TCP mechanisms for: data transfer control / flow control error control congestion control Graphical examples (applet java) of several algorithms at: http://www.ce.chalmers.se/~fcela/tcp-tour.html

Data transfer control over TCP a double-face issue: Bulk data transfer Interactive HTTP, FTP, goal: attempt to send data as fast as possible problems: sender may transmit faster than receiver Flow control TELNET, RLOGIN,... goal: attempt to send data as soon as possible Problem: efficiency - interactivity trade-off The tinygrams issue! (1 byte payload / segment 20 TCP + 20 IP header)

W=6 TCP pipelining More than 1 segment flying in the network Transfer efficiency increases with W thr = min C, W MSS RTT + MSS / C So, why an upper limit on W?

Why flow control? sender Limited receiver buffer If MSS = 2KB = 2048 bytes And receiver buffer = 8 KB = 8192 bytes Then W must be lower or equal than 4 x MSS receiver A possible implementation: During connection setup, exchange W value. DOES NOT WORK. WHY?

Window-based flow control receiver buffer capacity varies with time! Upon application process read() [asynchronous, not depending on OS, not predictable] Receiver buffer From IP Application process read() Receiver window MSS = 2KB = 2048 bytes Receiver Buffer capacity = 10 KB = 10240 bytes TCP data stored in buffer: 3 segments Receiver window = Spare room: 10-6 = 4KB = 4096 bytes Then, at this time, W must be lower or equal than 2 x MSS

Header length Source port 6 bit Reserved checksum 32 bit Sequence number 32 bit acknowledgement number U R G A C K P S H R ST S YN F IN Destination port Window size Urgent pointer Window size field: used to advertise receiver s remaining storage capabilities 16 bit field, on every packet Measure unit: bytes, from 0 (included) to 65535 Sender rule: LastByteSent - LastByteAcked <= RcvWindow. W=2048 means: I can accept other 2048 bytes since ack, i.e. bytes [ack, ack+w-1] also means: sender may have 2048 bytes outstanding (in multiple segments)

What is flow control needed for? Window flow control guarantees receiver buffer to be able to accept outstanding segments. When receiver buffer full, just send back win=0 in essence, flow control guarantees that transmission bit rate never exceed receiver rate in average! Note that instantaneous transmission rate is arbitrary as well as receiver rate is discretized (application reads)

W=3 S=4 S=5 S=6 Sliding window Dynamic window based reduces to pure sliding window when receiver app is very fast in reading data S=7 SEQ W=3 1 2 3 4 5 6 7 8 9 Window sliding forward

Dynamic window - example sender receiver Rec. Buffer TCP CONN SETUP Exchanged param: MSS=2K, sender ISN=2047, WIN=4K (carried by receiver SYN-ACK) 0 4K EMPTY Application does a 2K write 2K, seq=2048 0 4K Ack=4096, win=2048 2K Application does a 3K write Sender blocked Sender unblocks may send last 1K 2K, seq=4096 Ack=6144, win=0 Ack=6144, win=2048 1K, seq=6144 0 4K FULL Application does a 2K read 0 4K 2K

Performance: bounded by receiver buffer size Up to 1992, common operating systems had transmitter & receiver buffer defaulted at 4096 e.g. SunOS 4.1.3 way suboptimal over Ethernet LANs raising buffer to 16384 = 40% throughput increase (Papadopulos & Parulkar, 1993) e.g. Solaris 2.2 default most socket APIs allow apps to set (increase) socket buffer sizes But theoretical maximum remains W=65535 bytes

Maximum achievable throughput (assuming infinite speed line ) Throughput (Mbps) 1000 100 10 1 W = 65535 bytes 0 100 200 300 400 500 RTT (ms)

Window Scale Option Appears in SYN segment operates only if both peers understand option allows client & server to agree on a different W scale specified in terms of bit shift (from 1 to 14) maximum window: 65535 * 2 b b=14 means max W = 1.073.725.440 bytes!!

Blocked sender deadlock problem BLOCKED REMAINS BLOCKED FOREVER!! sender receiver Rec. Buffer ACK=X, WIN=2K Since ACK does not carry data, no ack from sender expected. 0 4K FULL Application read 0 4K 2K

Solution: Persist timer When win=0 (blocked sender), sender starts a persist timer Initially 500ms (but depends on implementation) When persist timer elapses AND no segment received during this time, sender transmits probe Probe = 1byte segment; makes receiver reannounce next byte expected and window size this feature necessary to break deadlock if receiver was still full, rejects byte otherwise acks byte and sends back actual win Persist time management (exponential backoff): Doubles every time no response is received Maximum = 60s

Interactive applications ideal rlogin operation: : 4 transmitted segments per 1 byte!!!!! Header overhead: 20 TCP header + 20 IP header + 1 data keystroke display Data byte Ack of data byte Echo of data byte server echo Ack of echoed byte CLIENT Interactive apps: create some tricky situations. SERVER

The silly window syndrome SCENARIO Interactive user (one byte at the time) Bulk data source TCP connection Full recv buffer

The silly window syndrome Fill up buffer until win=0 Buffer FULL Network loaded with tinygrams (40bytes header + 1 payload!!) Ack=X, win=1 1 byte Ack=X+1, win=0 1 byte read Buffer FULL Forever! Ack=X+1, win=1 1 byte Ack=X+2, win=0 1 byte read Buffer FULL

Silly window solution Problem discovered by David Clark (MIT), 1982 easily solved, by preventing receiver to send a window update for 1 byte rule: send window update when: receiver buffer can handle a whole MSS or half received buffer has emptied (if smaller than MSS) sender also may apply rule by waiting for sending data when win low

Nagle s algorithm (RFC 896, 1984) NAGLE RULE: a TCP connection can have only ONE SMALL outstanding segment self-clocking algorithm: on LANs, plenty of tynigrams on slow WANs, data aggregation 1 byte WAIT WAIT 1 byte ack 2 byte ack 3 byte

Comments about Nagle s algo Over ethernet: about 16 ms round trip time Nagle algo starts operating when user digits more than 60 characters per second (!!!) disabling Nagle s algorithm a feature offered by some TCP APIs set TCP_NODELAY example: mouse movement over X-windows terminal

Header length Source port 6 bit Reserved checksum PUSH flag 32 bit Sequence number 32 bit acknowledgement number U R G A C K P S H R ST S YN F IN Destination port Window size Urgent pointer Used to notify TCP sender to send data but for this an header flag NOT needed! Sufficient a push type indication in the TCP sender API TCP receiver to pass received data to the application

Header length Source port 6 bit Reserved checksum Urgent data 32 bit Sequence number 32 bit acknowledgement number U R G A C K P S H R ST S YN F IN Destination port Window size Urgent pointer URG on: notifies rx that urgent data placed in segment. When URG on, urgent pointer contains position of last byte of urgent data or the one after the last, as some bugged implementations do?? and the first? No way to specify it! receiver is expected to pass all data up to urgent ptr to app interpretation of urgent data is left to the app typical usage: ctrlc (interrupt) in rlogin & telnet; abort in FTP urgent data is a second exception to blocked sender

TCP Error control

TCP: a reliable transport TCP is a reliable protocol all data sent are guaranteed to be received very important feature, as IP is unreliable network layer employs positive acknowledgement cumulative ack selective ack may be activated when both peers implement it (use option) does not employ negative ack error discovery via timeout (retransmission timer) But implicit NACK is available

Error discovery via retransmission timer expiration Send segment Retransmission timer: waits for acknowledgement Re-send segment time Fundamental problem: setting the retransmission timer right!

Lost data == lost ack DATA DATA Retr timer Retr timer ack Retransmit DATA Retransmit DATA

although lost ack may be discovered via subsequent acks DATA 1 Retransm timer 1 Ack 1 DATA 2 Data 1 & 2 OK Ack 2 Retransm timer 2

Retransmission timer setting RTO = retransmission TimeOut RTO Too late!!!! DATA ack Retransmit DATA RTO DATA Might have txed!!!! ack TOO SHORT Retransmit DATA TOO LONG TOO SHORT: unnecessary retransmission occurs, loading the Internet with unnecessary packets TOO LONG: throughput impairment when packets lost

Retransmission timer setting Cannot be fixed by protocol! Two reasons: different network scenarios have very different performance LANs (short RTTs) WANs (long RTTs) same network has time-varying performance (very fast time scale) when congestion occurs (RTT grows) and disappears (RTT drops)

Adaptive RTT setting Proposed in RFC 793 based on dynamic RTT estimation sender samples time between sending SEQ and receiving ACK (M) estimates RTT (R) by low pass filtering M (autoregressive, 1 pole) R = α R + (1-α) M α = 0.9 sets RTO = R β β = 2 (recommended)

Problem: constant value β=2 SCENARIO 1: lightly loaded long-distance communication Propagation = 100 Queueing = mean 5, most in range 0-10 RTO = 2 x measured_rtt ~ 2 x 105 = 210 TOO LARGE! SCENARIO 2: mildly loaded short-distance communication Propagation = 1 Queueing = mean 10, most in range 0-50 RTO = 2 x measured_rtt ~ 2 x 11 = 22 WAY TOO SMALL!

Problem: constant value β=2 28.8 Kbps SCENARIO 3: slow speed links transmission delay (ms) 600 500 400 300 200 100 0 0 500 1000 1500 2000 2500 packet size (bytes) Natural variation of packet sizes causes a large variation in RTT! (from RFC 1122: utilization on 9.6 kbps link can improve from 10% up to 90% With the adoption of Jacobson algorithm)

Jacobson RTO (1988) idea: make it depend on measured variance! Err = M-A A := A + g Err D := D + h ( Err - D) RTO = A + 4D g = gain (1/8) conceptually equivalent to 1-α, but set to slightly different value D = mean deviation conceptually similar to standard deviation, but cheaper (does not require a square root computation) h = 1/4 Jacobson s implementation: based on integer arithmetic (very efficient)

Guessing right? Karn s problem Scenario 1 Scenario 2 DATA DATA RTO RTO Retransmit DATA M? retransmit ack M ack M?

Solution to Karn s problem Very simple: DO NOT update RTT when a segment has been retransmitted because of RTO expiration! Instead, use Exponential backoff double RTO for every subsequent expiration of same segment When at 64 secs, stay persist up to 9 minutes, then reset

Need for implicit NACKs TCP does not support negative ACKs This can be a serious drawback Especially in the case of single packet loss Necessary RTO expiration to start retransmit lost packet As well as following ones!! RTO Seq=50 Seq=100 Seq=150 Seq=200 Seq=250 Seq=300 Seq=350 ISSUE: is there a way to have NACKs in an implicit manner???? Retransmit Seq=100

The Fast Retransmit Algorithm Idea: use duplicate ACKs! Receiver responds with an ACK every time it receives an outof-order segment ACK value = last correctly received segment FAST RETRANSMIT algorithm: if 3 duplicate acks are received for the same segment, assume that the next segment has been lost. Retransmit it right away. Helps if single packet lost. Not very effective with multiple losses And then? A congestion control issue RTO ack=100 ack=100 ack=100 ack=100: FR Seq=50 Seq=100 Seq=150 Seq=100