Docsity

TCP Transport Layer: Data Transfer and Congestion Control, Slides of Computer Networks

Partial preview of the text

Download TCP Transport Layer: Data Transfer and Congestion Control and more Slides Computer Networks in PDF only on Docsity!

3: Transport Layer 3b-

7: TCP Normal Data Flow

3: Transport Layer 3b-

Data Transfer in the

ESTABLISHED state

3: Transport Layer 3b-

Data Transfer (Simplified One-

Way)

Sender

Data (SequenceNum)

Acknowledgment + AdvertisedWindow

Receiver

3: Transport Layer 3b-

TCP connection: One Direction

Application process

Write bytes

TCP Send buffer

Segment Segment Segment Transmit segments

Application process

Read bytes

TCP Receive buffer

…

… …

3: Transport Layer 3b-

TCP Details: Roadmap

 Data Flow

 Interactive  Bulk Data

 Timeout/Retransmission

 Slow Start/ Congestion Avoidance

3: Transport Layer 3b-

Interactive data: Small

packets

 Example: Telnet/Rlogin  Send each interactive key stroke in a separate TCP packet  server side echos that same character back to be displayed on the local screen

 How big are these TCP packets containing a single byte of data?  1 byte data  20 bytes (at least) for TCP header  20 bytes for IP header  < 3% data!  Do we want to fill the pipeline with small packets like this?

3: Transport Layer 3b-

Delayed ACKs

Problem: Would like to send more data at once or at least piggyback the acks  Solution: Delay the ACK for some time hoping for some data to go in the other direction or for more incoming data for a cumulative ack  Can we do better than this?

Host A Host B User types ‘C’

host ACKs receipt of echoed ‘C’

host ACKs receipt of ‘C’, echoes back ‘C’

Ack not sent immediately; Delayed hoping to piggy back With data or other ACK

simple telnet scenario

3: Transport Layer 3b-

Nagle Algorithm

 If a TCP connection has outstanding data for which an acknowledgement has not yet been received, do not send small segments  Instead wait for an acknowledgement to be received then send all data collected to that point  If collect MSS, go ahead and send without waiting for ACK

 Adjusts to network conditions  If ACKs coming back rapidly (like on a LAN), data will be sent rapidly  If ACKs coming back slowly (like on a WAN), will collect more data together in that time to send together

3: Transport Layer 3b-

TCP Receiver: ACK generation

[RFC 1122, RFC 2581]

Event

in-order segment arrival, no gaps, everything else already ACKed in-order segment arrival, no gaps, one delayed ACK pending

out-of-order segment arrival higher-than-expect seq. # gap detected arrival of segment that partially or completely fills gap

TCP Receiver action

delayed ACK. Wait up to 500ms for next segment. If no next segment, send ACK

immediately send single cumulative ACK

send duplicate ACK, indicating seq. # of next expected byte (sender can use as hint of selective repeat) immediate ACK if segment starts at lower end of gap

3: Transport Layer 3b-

Experiment: Interactive Data

 Use Ethereal to trace a telnet or rlogin

session

3: Transport Layer 3b-

Bulk Data Transfer

 Receiver will send

ACKs of data

received but with

reduced window

sizes

 When window opens

up (I.e. app reads

data from kernel

buffers), send a

“window update”

message

Host A

time

Host B

3: Transport Layer 3b-

Lost Window Update?

 What if the last window update message is

lost?

 Receiver waiting for data  Sender not allowed to send anything

 Solutions?

 Set timer on receiver after sending window update; If don’t here from sender retransmit  Sender periodically sends 1 byte of data even if window is 0

 Which do you think was chosen? Internet

Principle of putting complexity on sender?

3: Transport Layer 3b-

Silly Window Syndrome

 Occurs when small amounts of data are exchanged over a connection instead of large amounts  Sender only knows they can send X bytes of data  Receiver can really take 2X but hasn’t had a chance to announce it; gets X bytes so can only advertise X again

 Solutions?  Receiver doesn’t advertise small windows; Instead waits till larger window opens up  Sender holds off sending data till larger amount accumulated  Which? In this case both

3: Transport Layer 3b-

Preventing Silly Window

 Receiver will not advertise a larger window

until the window can be increased by one

full-sized segment or by half of the

receiver’s buffer space whichever is

smaller

 Sender waits to transmit until either a full

sized segment (MSS) can be sent o r at

least half of the largest window ever

advertised by the receiver can be sent or

it can send everything in the buffer