Congestion / Flow Control in TCP

Similar documents
Transport Layer Protocols

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

TCP Westwood for Wireless

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

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

Computer Networks. Chapter 5 Transport Protocols

TCP over Wireless Networks

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

TCP in Wireless Mobile Networks

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

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

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

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

Final for ECE374 05/06/13 Solution!!

Chapter 5. Transport layer protocols

TCP Adaptation for MPI on Long-and-Fat Networks

This sequence diagram was generated with EventStudio System Designer (

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

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

Data Networks Summer 2007 Homework #3

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

2 TCP-like Design. Answer

Chapter 6 Congestion Control and Resource Allocation

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

1. The subnet must prevent additional packets from entering the congested region until those already present can be processed.

17: Queue Management. Queuing. Mark Handley

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

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

Active Queue Management (AQM) based Internet Congestion Control

[Prof. Rupesh G Vaishnav] Page 1

Congestions and Control Mechanisms n Wired and Wireless Networks

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

Visualizations and Correlations in Troubleshooting

Parallel TCP Data Transfers: A Practical Model and its Application

Computer Networks UDP and TCP

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

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

High Speed Internet Access Using Satellite-Based DVB Networks

Mobile Communications Chapter 9: Mobile Transport Layer

Transport Layer and Data Center TCP

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

Effect of Packet-Size over Network Performance

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

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

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

SELECTIVE-TCP FOR WIRED/WIRELESS NETWORKS

TCP Over Wireless Network. Jinhua Zhu Jie Xu

Ina Minei Reuven Cohen. The Technion. Haifa 32000, Israel. Abstract

Higher Layer Protocols: UDP, TCP, ATM, MPLS

Low-rate TCP-targeted Denial of Service Attack Defense

Transport layer protocols for ad hoc networks

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

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

TCP/IP Over Lossy Links - TCP SACK without Congestion Control

QUALITY OF SERVICE INTRODUCTION TO QUALITY OF SERVICE CONCEPTS AND PROTOCOLS

Analytic Models for the Latency and Steady-State Throughput of TCP Tahoe, Reno and SACK

TCP in Wireless Networks

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

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

On Inferring TCP Behavior

15-441: Computer Networks Homework 2 Solution

STUDY OF TCP VARIANTS OVER WIRELESS NETWORK

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

TTC New Reno - Consistent Control of Packet Traffic

Computer Networks - CS132/EECS148 - Spring

Ethernet. Ethernet. Network Devices

Delay-Based Early Congestion Detection and Adaptation in TCP: Impact on web performance

A Test To Allow TCP Senders to Identify Receiver Cheating

TCP for Wireless Networks

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

Analysis of Internet Transport Service Performance with Active Queue Management in a QoS-enabled Network

TCP, Active Queue Management and QoS

A Study on TCP Performance over Mobile Ad Hoc Networks

TCP Performance Management for Dummies

Homework 3 assignment for ECE374 Posted: 03/13/15 Due: 03/27/15

IP - The Internet Protocol

SJBIT, Bangalore, KARNATAKA

TCP Fast Recovery Strategies: Analysis and Improvements

Chaoyang University of Technology, Taiwan, ROC. 2 Department of Computer Science and Information Engineering

Per-Flow Queuing Allot's Approach to Bandwidth Management

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

Why Congestion Control. Congestion Control and Active Queue Management. Max-Min Fairness. Fairness

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

Transport layer issues in ad hoc wireless networks Dmitrij Lagutin,

Analysis of Congestion Models for TCP Networks

Analysis and Detection of a Denial-of-Service Attack Scenario generated by TCP Receivers to Edge Network

Basic Multiplexing models. Computer Networks - Vassilis Tsaoussidis

What is a DoS attack?

Comparative Analysis of Congestion Control Algorithms Using ns-2

TCP based Denial-of-Service Attacks to Edge Network: Analysis and Detection

Protagonist International Journal of Management And Technology (PIJMT) Online ISSN Vol 2 No 3 (May-2015) Active Queue Management

Measuring IP Performance. Geoff Huston Telstra

Random Early Detection Gateways for Congestion Avoidance

A Transport Protocol for Multimedia Wireless Sensor Networks

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Networking part 3: the transport layer

Transport Layer. Chapter 3.4. Think about

Performance improvement of active queue management with per-flow scheduling

AN IMPROVED SNOOP FOR TCP RENO AND TCP SACK IN WIRED-CUM- WIRELESS NETWORKS

International Journal of Scientific & Engineering Research, Volume 6, Issue 7, July ISSN

Transcription:

Congestion and Flow Control in 1

Flow Control and Congestion Control Flow control Sender avoids overflow of receiver buffer Congestion control All senders avoid overflow of intermediate network buffers Buffer fill rate Bytes / second arriving from network Buffer empty rate Bytes / second leaving to network or application layer Buffer file time T Example T overflow overflow = buffer size buffer fill rate buffer empty rate Arriving bytes 64 KB 64 KB = = = 16 seconds 8 KB/sec 4 KB/sec 4 KB/sec Empty Full Leaving bytes 2

Congestion Control Flow control Avoid overflow in receiver buffer Congestion control Avoid overflow in router buffers Flow Control Buffer Router Buffer 3

Queuing Theory Assumptions Segments arrive independently (Poisson statistics) Random length (bytes) Average arrival rate in steady state Segments leave independently (Poisson statistics) Average emptying rate in steady state Results arrival rate ρ = Utilization = empty rate 1 1 1 Latency = = empty rate arrival rate empty rate 1 ρ ρ Buffer Level = Latency arrival rate = 1 ρ 20 18 16 14 12 10 8 6 4 2 0 0 0.1 latency buffer level 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Utilization ρ 4

Buffer Throughput (Over)-simplified throughput model throughtput = receive rate maximum receive rate 1 latency throughput at receivers arrival rate buffer utilization = empty rate receive rate (error free in order) goodput = maximum receive rate 1 buffer utilization (from all senders) latency Realistic throughput behavior at receivers High arrival rate at buffer Longer latency + overflow 1 Sender timeouts Re-transmit more segments higher arrival rate at buffer 1 throughput buffer utilization (from all senders) 5

Flow Control Source window Initial source window = maximum number of "unacked" bytes Determined by congestion + flow control Destination window Number of bytes receiver can accept Determined by available space in receiver buffer Buffer level = Previous level + arriving bytes bytes read by lication reads too slowly decrease destination window Sliding window Arriving Windows field in header bytes Number of bytes receiver will accept Receiver discards bytes above window size Empty Full Bytes read by 6

Flow Control Example Dest Window In Flight 64 KB 64 KB 2 KB 64 KB 4 KB 64 KB 4 KB 4 KB 0 2 KB 2 KB 6 KB 0 KB 0 6 KB 0 0 ACK 4 KB 2+2 = 4 ACK 6 KB 2+4 = 6 ACK 12 KB 6+6 = 12 2 KB 2 KB window = 4 KB 2 KB window = 6 KB 6 KB window = 0 KB Buffer Level 0 0 2 KB 4 KB 6 KB 2 KB reads 4 KB 2 KB 6 KB 8 KB Dest Window 8 KB 8 KB 6 KB 4 KB 0 Persist Timeout 4 KB 0 error ACK 12 KB 6+6 = 12 window = 4 KB 1 B ACK 12 KB + 1B window = 4 KB reads 4 KB 4 KB 4 KB 7

Receive Window Bugs 1 Bug deadlock Receiver advertises window = 0 Window update with window > 0 is lost deadlock Sender Receiver win = 0 1 byte Fix persist timeout Sender attempts small segment ACK contains new window size error win = 0 win > 0 1 byte ACK win > 0 8

Receive Window Bugs 2 Silly Window Problem lication reads received data slowly Receiver advertises small window Data bytes ~ header bytes More segments / file transfer larger total traffic (data + headers) Nagle Algorithm bug fix for Silly Window Sender accumulates application data sends large segments Works badly with Telnet (requires small segments) Receiver side bug fix Receiver keeps 0 window size until it can advertise large window 9

Congestion Control End-to-end congestion control Based on host estimates No feedback from intermediate network nodes Slow-start Begin session with low transmission rate Increase rate until timeouts begin Fast retransmit Do not wait for timeout Re-transmit after duplicate ACKs (dupacks) Congestion avoidance Limit transmission rate after duplicate ACKs Transmission rate initial slow-start rate Fast recovery Congestion avoidance with larger transmission rate 10

Slow Start Congestion window (cwnd) Source window Maximum number of "unacked" bytes Initial cwnd = 1 MSS (maximum segment size) Data rate = 1 MSS / RTT Maximum cwnd = destination window Sender Receiver RTT ACK 1 MSS ACK 2 MSS Exponential growth On (ACK) cwnd cwnd + size of data ACKed if (cwnd > maximum cwnd) cwnd max cwnd On (ACK timeout) cwnd initial cwnd = 1 MSS Timeout ACK 3 MSS 11

Computing 's Retransmission Timer RFC 2988 Initialize RTO 3 seconds Sender SEQ Receiver G clock granularity (typically 500 ms) R first RTT measurement (round trip time) SRTT R RTTVAR R/2 RTO max(1 sec, SRTT + max(g, 4 * RTTVAR)) Update after measurements R' RTTVAR (1 - β) * RTTVAR + β * SRTT R' SRTT (1 - α) * SRTT + α * R' RTO max(1 sec, SRTT + max (G, 4 * RTTVAR)) α = 1/8 β = 1/4 RTT ACK 12

Fast Retransmit Better performance with RTO >> RTT 3 duplicate ACKs (dupacks) for segment re-send segment Sender Receiver 13 error SEQ = 100 SEQ = 200 SEQ = 300 ACK = 200 SEQ = 400 SEQ = 500 SEQ = 200 (duplicate) ACK = 200 (duplicate) ACK = 200 (duplicate) ACK = 200 (duplicate) Timeout ACK = 600

Congestion Avoidance Tahoe protocol Slow start threshold ssthresh large initial value (possibly maximum cwnd) Slow start phase On (ACK && cwnd < ssthresh) cwnd cwnd + size of data ACKed Congestion avoidance phase On (ACK && cwnd > ssthresh) cwnd cwnd + 1 MSS (exponential linear growth) Fast retransmit On (ACK timeout 3 dupacks) ssthresh cwnd (pre-timeout value) cwnd initial cwnd = 1 MSS 14

Congestion Avoidance Reno protocol Slow start phase On (ACK && cwnd < ssthresh) cwnd cwnd + size of data ACKed On (ACK timeout) ssthresh cwnd cwnd initial cwnd = 1 MSS RTO 2 * RTO Congestion avoidance phase On (ACK && cwnd > ssthresh) cwnd cwnd + 1 MSS Fast retransmit with fast recovery On (3 dupacks) ssthresh cwnd cwnd cwnd / 2 Retransmit lost packet Wait 1 RTT continue sending For > 3 dupacks cwnd++ on each new dupack 15

Sender with Reno 1 // initialize SEQ = ISN + 1 SendBase = ISN + 1 InFlight = 0 cwnd = 1 MSS Set ssthreshold large (local policy) RTO = timeout on (new data from application) Prepare data segment:sequence number = SEQ if InFlight < min{cwnd,sendwindow,recvwindow) Pass segment to SEQ = SEQ + length(data) InFlight = InFlight + length(data) if!(timer running) timer = RTO 16

Sender with Reno 2 if (receive ACK = y) stop timer if (y > SendBase) dupack = 0 newacks = y SendBase // bytes ACKed SendBase = y InFlight = InFlight newacks if (cwnd < ssthresh) cwnd = cwnd + newacks else cwnd = cwnd + 1 MSS if (InFlight > 0) timer = RTO 17

Sender with Reno 3 // if (y > SendBase) else dupack++ if (dupack = 3) SEQ = SendBase = min{unacked SEQ} and resend timer = RTO ssthresh = cwnd cwnd = cwnd / 2 wait 1 RTT // wait for ACK of resent packet if (dupack > 3) cwnd = cwnd + 1 MSS if (timeout) SEQ = SendBase = min{unacked SEQ} and resend ssthresh = cwnd cwnd = initial cwnd = 1 MSS RTO = 2 * RTO timer = RTO 18

Receiver with Reno 1 // initialize Set RecvWindow = receiver buffer size expected = Sender ISN + 1 ack_buffer = 0 ack_max (local policy: delayed ACK trigger) ack_delay = 250 msec (local policy: < 500 msec) Start ACK delay timer = ack_delay if (ACK delay timer = 0 && ack_buffer > 0) Send ACK = expected with updated RecvWindow ACK delay timer = ack_delay ack_buffer = 0 19

Receiver with Reno 2 if (receive SEQ = x) if (x = expected && error-free) expected = expected + length(data) if (NACK = 1) Send ACK = expected with updated RecvWindow ACK delay timer = ack_delay ack_buffer = 0 NACK = 0 else if (ack_buffer < ack_max) nextack = expected ack_buffer++ else if (ack_buffer = ack_max) Send ACK = expected with updated RecvWindow ACK delay timer = ack_delay ack_buffer = 0 else Send ACK = expected with updated RecvWindow ACK delay timer = ack_delay NACK = 1 20

Selective Acknowledgment Option Selective ACK (SACK) Permits ACK for segments with gaps Option negotiated between hosts Defined in RFC 2018 Example Last ACK = 5000 Send 8 segments 500 data bytes / segment Case 1 Case 2 First 4 segments received and last 4 dropped Receiver returns normal ACK = 5000 + 4 * 500 = 7000 No SACK option field First segment lost and 7 segments received For each segment receiver returns segment with ACK = 5000 SACK option field with start + end ACK Data 5000 5500 6000 6500 7000 7500 8000 8500 ACK 5000 5000 5000 5000 5000 5000 5000 Option Field Start End 5500 6000 5500 6500 5500 7000 5500 7500 5500 8000 5500 8500 5500 9000 21

Active Queue Management (AQM) Standard Queue At receiver Full buffer drop excess packets At sender No ACK timeout signal congestion Random Early Detection (RED) Router Sender Detects congestion early Drops random packets Sees dupacks or timeout Assumes congestion Lowers cwnd 1 Arriving packets 0.85 1 latency Empty Full throughput at receivers buffer utilization (all senders) Leaving packets 22

RED Algorithm Algorithm for each packet arrival calculate avg = average queue size if min th avg < max th calculate probability p a with probability p a : mark arriving packet for drop else if max th avg mark arriving packet for drop Parameters max p = maximum mark probability (0.1 to 0.5) min th ~ 5 max th ~ 30 p b max p (avg min th ) / (max th min th ) p a p b / (1 count p b ) count = number of consecutive dropped packets 23

AQM with ECN Explicit Congestion Notification (RFC 3168) 1. router predicts congestion RED with mark (no drop) 2. router indicates congestion to receiver in header 3. Receiver indicates congestion to sender in ACK header 3 segment with ECN datagram 85% 1 2 Full datagram with ECN 24

Explicit Congestion Notification (ECN) datagram 4 bits 4 bits 6 bits 2 bits 16 bits Version Hlen Differentiated Services Code Point (DSCP) QoS requirements DSCP ECN Identification Flags Fragment Offset (13 bits) Time to Live Protocol Header Checksum Source Address Destination Address Options Data Explicit Congestion Notification (ECN) Total Length (header + data in bytes) 00 01 10 11 Not ECN capable ECT(0) ECN Capable Transport (0) ECT(1) ECN Capable Transport (1) CE (Congestion Experienced) For retransmissions Two allow protocol error checking 25

Explicit Congestion Notification (ECN) header flags HLEN source port not used checksum 32 bits sequence number (SEQ) acknowledgement number (ACK) flags Options destination port window size urgent pointer NS ECN nonce concealment protection CWR Congestion Window Reduced (CWR) flag URG Urgent pointer ECE ECN Echo ACK Acknowledgment PSH Push buffer RST Reset SYN Synchronize FIN No more data 26

ECN Negotiation client SYN ECE = CWR = 1 in SYN server ECE = 1 in SYN-ACK ECT(0) = ECT(1) in SYN and SYN-ACK client server SYN with ECE = CWR = 1 SYN ACK with ECE = 1 CWR = 0 ACK 27

ECN Operation 1 No congestion Measure long term average buffer level n Compare with threshold level th segment ECE = CWR = 0 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 28

ECN Operation 2 No congestion ACK ECE = CWR = 0 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 29

ECN Operation 3 Incipient congestion Router Sees ECN = ECT in incoming header Sets ECN = CE in outgoing header Notifies receiver of incoming congestion segment ECE = CWR = 0 datagram ECN = 01 (ECT) n > th datagram ECN = 11 (CE) 30

ECN Operation 4 Incipient congestion Receiver Sets ECE = 1 in header Notifies sender of congestion ACK ECE = 1 CWR = 0 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 31

ECN Operation 5 Incipient congestion Sender Lowers congestion window (once per RTT) Sets CWR = 1 in header (ACK of ECE to receiver) segment ECE = 0 CWR = 1 datagram ECN = 01 (ECT) n > th datagram ECN = 11 (CE) 32

ECN Operation 6 Incipient congestion Receiver Sees CWR = 1 in sender header CE in header new incoming ECE = 1 in ACK header ACK ECE = 1 CWR = 0 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 33

ECN Operation 7 Continued congestion Sender Lowers congestion window once per RTT Sets CWR = 1 in header (ACK of ECE) segment ECE = 0 CWR = 1 datagram ECN = 01 (ECT) n > th datagram ECN = 11 (CE) 34

ECN Operation 8 Continued congestion Receiver Sees CWR = 1 in sender header CE in header new incoming ECE = 1 in ACK header ACK ECE = 1 CWR = 0 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 35

ECN Operation 9 End of congestion Sender sets CWR = 1 in header (ACK of ECE) Router sends ECN = 01 in header (signals no congestion) segment ECE = 0 CWR = 1 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 36

ECN Operation 10 End of congestion Receiver sends ECE = 0 in header (signals no congestion) ACK ECE = CWR = 0 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 37

ECN Operation 11 End of congestion Sender clears CWR and begins raising congestion window Router sends ECN = 01 in header segment ECE = CWR = 0 datagram ECN = 01 (ECT) n < th datagram ECN = 01 (ECT) 38

RED and ECN Goodput Parameters min th = 5 max th = 30 10 9.5 9 Goodput (Mbps) 8.5 8 7.5 7 6.5 6 5.5 5 ECN (max_p=0.1) RED (max_p=0.1) ECN (max_p=0.5) RED (max_p=0.5) 0 100 200 300 400 500 600 Number of flows Ref: Kinicki and Zheng, A Performance Study of Explicit Congestion Notification (ECN) with Heterogeneous Flows 39

RED and ECN Delay Parameters min th = 5 max th = 30 max p =0.5 0.2 0.18 One-way delay (Seconds) 0.16 0.14 0.12 0.1 0.08 0.06 0.04 0.02 0 ECN (Fragile flows) ECN (Average flows) ECN (Robust flows) RED (Fragile flows) RED (Average flows) RED (Robust flows) 0 100 200 300 400 500 600 Number of flows 40

Goodput with 120 flows Parameters min th = 5 max th = 30 Goodput (Mbps) 10 9.5 9 8.5 8 7.5 7 6.5 6 5.5 5 ECN (max_th=15) RED (max_th=15) ECN (max_th=30) RED (max_th=30) 0 0.2 0.4 0.6 0.8 1 max_p 41

ECN Nonce (RFC 3540) Problem Unscrupulous or poorly implemented receiver Clears ECN-Echo no congestion signals to sender Gives receiver advantage over connections that behave properly Sender header with ECN = 01 = ECT(0) or ECN = 10 = ECT(1) Except retransmissions (Not ECN Capable) and CE packets Keeps per-packet map of SEQ to nonce (0 or 1) Router Forwards packet or overwrites ECT with ECN = 01 = CE Receiver Keeps cumulative ACK number (standard ) Keeps cumulative sum % 2 of received nonces for ACKed packets NS flag in header = sum of nonces for ACKed packets CE packets use nonce = 0 42

Nonce Example Honest Receiver NS initialized to 1 Sent in SYN ACK and ACK of handshake Sender Receiver Nonce Sum 43 SEQ_1 ECT(0) 1 SEQ_2 ECT(0) 1 SEQ_3 ECT(1) 0 SEQ_4 ECT(0) 0 SEQ_5 ECT (1) 0 SEQ_5 CE nonce = 0 ACK_3 NS = 0 SEQ_6 ECT(1) 1 ACK_6 NS = 1

Nonce Example Cheating Receiver Receiver ignores CE Does not set ECE Guesses nonce sum on CE Sender Receiver Guess 44 SEQ_1 ECT(1) sum = 0 0 SEQ_2 ECT(0) sum = 0 0 SEQ_3 ECT(1) sum = 1 0 SEQ_4 ECT(0) sum = 1 SEQ_5 ECT (1) sum = 0 SEQ_3 CE nonce = 0 0 1 ACK_3 NS = 0 (guess) SEQ_6 ECT(0) sum = 0 1 ACK_6 NS = 1 (guess)