By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

32
By N.Gopinath AP/CSE Unit: III Introduction to Transport layer

Transcript of By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Page 1: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

ByN.Gopinath

AP/CSE

Unit: IIIIntroduction to Transport layer

Page 2: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP Overview

Page 3: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

End to end issues

Page 4: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Segment format

Page 5: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Connection establishment

Page 6: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.
Page 7: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP sliding window

Page 8: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.
Page 9: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Stream control Transmission Protocol

Page 10: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Simple demultiplexor

Page 11: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP Congestion Control• Determines the network capacity• Adjust the number of packets that can have safely in transit• Acks to pace the transmission of packets• TCP is self clocking• Avoids congestion• Maxwindow=MIN(CongestionWindow,AdvertisedWindow)• EffectiveWindow=MaxWindow-(LastByteSent-LastByteAcked)

Page 12: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Caused By• the shortage of buffer space. • slow links. • slow processors

• Possible solutions– End-to-end versus link-by-link control– Rate-Based versus Credit-Based control– The rate-based traffic-flow technique constantly – Integrated congestion control

• Integrated congestion control

Page 13: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Principles of Congestion Control

Congestion:• informally: “too many sources sending too much data too fast

for network to handle”• different from flow control!• manifestations:

– lost packets (buffer overflow at routers)– long delays (queueing in router buffers)

• a top-10 problem!

Page 14: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Scenario 1: Queuing Delays • two senders, two

receivers• one router, infinite

buffers • no retransmission

• large delays when congested

• maximum achievable throughput

unlimited shared output link buffers

Host Ain : original data

Host B

out

Page 15: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Scenario 2: Retransmits • one router, finite buffers • sender retransmission of lost packet

finite shared output link buffers

Host A in : original data

Host B

out

'in : original data, plus retransmitted data

Page 16: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Scenario 3: Congestion Near Receiver• four senders• multihop paths• timeout/retransmit

in

Q: what happens as and increase ?

in

finite shared output link buffers

Host Ain : original data

Host B

out

'in : original data, plus retransmitted data

Page 17: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Approaches towards congestion control

End-end congestion control:• no explicit feedback from

network• congestion inferred from end-

system observed loss, delay• approach taken by TCP

Network-assisted congestion control:

• routers provide feedback to end systems– single bit indicating

congestion (SNA, DECbit, TCP/IP ECN, ATM)

– explicit rate sender should send at

Two broad approaches towards congestion control:

Page 18: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP Congestion Control• end-end control (no network

assistance)• sender limits transmission: LastByteSent-LastByteAcked CongWin• Roughly,

• CongWin is dynamic, function of perceived network congestion

How does sender perceive congestion?

• loss event = timeout or 3 duplicate acks

• TCP sender reduces rate (CongWin) after loss event

three mechanisms:– AIMD– slow start– conservative after timeout

events

rate = CongWin

RTT Bytes/sec

Page 19: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP AIMD

8 Kbytes

16 Kbytes

24 Kbytes

time

congestionwindow

multiplicative decrease: cut CongWin in half after loss event

additive increase: increase CongWin by 1 MSS every RTT in the absence of loss events: probing

Long-lived TCP connection

Page 20: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP Slow Start

• When connection begins, CongWin = 1 MSS– Example: MSS = 500 bytes &

RTT = 200 msec– initial rate = 20 kbps

• available bandwidth may be >> MSS/RTT– desirable to quickly ramp up

to respectable rate

When connection begins, increase rate exponentially fast until first loss event

Page 21: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP Slow Start (more)• When connection begins,

increase rate exponentially until first loss event:– double CongWin every RTT– done by incrementing CongWin for every ACK received

• Summary: initial rate is slow but ramps up exponentially fast

Host A

one segment

RTT

Host B

time

two segments

four segments

Page 22: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Refinement (more)

Q: When should the exponential increase switch to linear?

A: When CongWin gets to 1/2 of its value before timeout.

Implementation:• Variable Threshold • At loss event, Threshold is set to

1/2 of CongWin just before loss event

Page 23: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

TCP sender congestion control

Event State TCP Sender Action Commentary

ACK receipt for previously unacked data

Slow Start (SS)

CongWin = CongWin + MSS, If (CongWin > Threshold) set state to “Congestion Avoidance”

Resulting in a doubling of CongWin every RTT

ACK receipt for previously unacked data

CongestionAvoidance (CA)

CongWin = CongWin+MSS * (MSS/CongWin)

Additive increase, resulting in increase of CongWin by 1 MSS every RTT

Loss event detected by triple duplicate ACK

SS or CA Threshold = CongWin/2, CongWin = Threshold,Set state to “Congestion Avoidance”

Fast recovery, implementing multiplicative decrease. CongWin will not drop below 1 MSS.

Timeout SS or CA Threshold = CongWin/2, CongWin = 1 MSS,Set state to “Slow Start”

Enter slow start

Duplicate ACK

SS or CA Increment duplicate ACK count for segment being acked

CongWin and Threshold not changed

Page 24: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Congestion Avoidance Mechanisms• Helps to avoid congestion• Additional functionality into the router to assist in anticipation of

congestion• to control congestion once it happens

• to repeatedly increase load in an effort to find the point at which congestion occurs, and then back off

Page 25: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Mechanisms• router-centric: DECbit and RED Gateways

• host-centric: TCP Vegas

Page 26: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

DECbit

Page 27: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

DECbit

• Add binary congestion bit to each packet header • Router

– monitors average queue length over last busy+idle cycle

– set congestion bit if average queue length greater than 1 when packet arrives

– attempts to balance throughput against delay •

Page 28: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

DECbit

• End Hosts • destination echos bit back to source

• source records how many packets resulted in set bit

• if less than 50% of last window's worth had bit set, then increase CongestionWindow by 1 packet

• if 50% or more of last window's worth had bit set, then decrease CongestionWindow by 0.875 times

Page 29: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

29

UDP—User Datagram Protocol• An unreliable, connectionless transport layer protocol• UDP format. See picture • Two additional functions beyond IP:

– Demultiplexing: deliver to different upper layer entities such as DNS, RTP, SNMP based on the destination port # in the header. i.e., UDP can support multiple applications in the same end systems.

– (Optionally) check the integrity of entire UDP. (recall IP only checks the integrity of IP header.)

• If source does not want to compute checksum, fill checksum with all 0s.• If compute checksum and the checksum happens to be 0s, then fill all 1s.• UDP checksum computation is similar to IP checksum, with two more:

– Add extra 0s to entire datagram if not multiple of 16 bits.– Add pseudoheader to the beginning of datagram. UDP pseudoheader

Page 30: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

30

Source Port Destination Port

UDP Length UDP Checksum

Data

0 16 31

Figure 8.16

UDP datagram

Back to UDP—User Datagram Protocol

Page 31: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

31

0 0 0 0 0 0 0 0 Protocol = 17 UDP Length

Source IP Address

Destination IP Address

0 8 16 31

Figure 8.17

UDP pseudoheader

1.Pseudoheader is to ensure that the datagram has indeed reached the correct destination host and port.2. The padding of 0s and pseudoheader is only for the computation of checksum and not be transmitted.

Back to UDP—User Datagram Protocol

Page 32: By N.Gopinath AP/CSE Unit: III Introduction to Transport layer.

Thank u