CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends...

36
CPSC 601.38 1 Tutorial: TCP 101 The Transmission Control Protocol (TCP) is the protocol that sends your data reliably Used for email, Web, ftp, telnet, p2p,… Makes sure that data is received correctly: right data, right order, exactly once Detects and recovers from any problems that occur at the IP network layer Mechanisms for reliable data transfer: sequence numbers, acknowledgements, timers, retransmissions, flow control...
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    221
  • download

    2

Transcript of CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends...

Page 1: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 1

Tutorial: TCP 101

The Transmission Control Protocol (TCP) is the protocol that sends your data reliably

Used for email, Web, ftp, telnet, p2p,… Makes sure that data is received correctly:

right data, right order, exactly once Detects and recovers from any problems

that occur at the IP network layer Mechanisms for reliable data transfer:

sequence numbers, acknowledgements, timers, retransmissions, flow control...

Page 2: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 2

TCP 101 (Cont’d)

TCP is a connection-oriented protocol

SYNSYN/ACK

ACKGET URL

YOUR DATA HERE

FIN FIN/ACKACK

Web Client Web Server

Page 3: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 3

TCP 101 (Cont’d)

TCP slow-start and congestion avoidance

ACK

Page 4: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 4

TCP 101 (Cont’d)

TCP slow-start and congestion avoidance

ACK

Page 5: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 5

TCP 101 (Cont’d)

TCP slow-start and congestion avoidance

ACK

Page 6: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 6

TCP 101 (Cont’d)

This (exponential growth) “slow start” process continues until either: packet loss: after a brief recovery phase,

you enter a (linear growth) “congestion avoidance” phase based on slow-start threshold found

limit reached: slow-start threshold, or maximum advertised receive window size

all done: terminate connection and go home

Page 7: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 7

Tutorial: TCP 201

There is a beautiful way to plot and visualize the dynamics of TCP behaviour

Called a “TCP Sequence Number Plot” Plot packet events (data and acks) as

points in 2-D space, with time on the horizontal axis, and sequence number on the vertical axis

Example: Consider a 14-packet transfer

Page 8: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 8

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

Page 9: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 9

So What?

What can it tell you?

Everything!!!

Page 10: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 10

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

RTT

Page 11: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 11

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

TCPSeg.Size

Page 12: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 12

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

TCP Connection Duration

Page 13: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 13

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

NumBytesSent

Page 14: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 14

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

Avg T

hrou

ghpu

t (Byte

s/Sec

)

Bytes

Sec

Page 15: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 15

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++Access

Network Bandwidth(Bytes/Sec)

Page 16: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 16

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

Sender’sFlow ControlWindow Size

Page 17: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 17

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

TCP SlowStart

Page 18: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 18

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

+

+

+

++

+

+

Delayed ACK

Page 19: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 19

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet

XXXX

XXXX

XX

X

++

++++

+

++++

PacketLoss

DuplicateACK

Page 20: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 20

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet

XXXX

XXXX

XX

X

++

++++

+

+++

X+

Retransmit

Cumulative ACK

+

Page 21: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 21

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet

XXXX

XXXX

XX

X

++

++++

+

+++

X+

RTO

+

Page 22: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 22

TCP 201 (Cont’d)

What happens when a packet loss occurs?

Quiz Time... Consider a 14-packet Web document For simplicity, consider only a single packet

loss

Page 23: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 23

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

Page 24: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 24

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

X

++

++++

+

+++

++

?

Page 25: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 25

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

X

++

++++

+

+++

++

X +

Page 26: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 26

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

Page 27: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 27

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

X

++

++++

+

++

++

?

Page 28: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 28

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

+

+++

++

Page 29: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 29

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

Page 30: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 30

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXX

XXXX

XX

XX

++

++++

+

++

?

Page 31: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 31

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXX

XXXX

XX

XX

++

++++

+

+++++

X

+

Page 32: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 32

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet X

XXXX

XXXX

XX

XX

++

++++

+

++++

++

Page 33: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 33

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet

X +?

Page 34: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 34

Time

Seq

Num

X +

Key: X Data Packet + Ack Packet

XX

X + ++X

XX +

+

+

X +X +X +

Page 35: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 35

TCP 201 (Cont’d)

Main observation: “Not all packet losses are created equal”

Losses early in the transfer have a huge adverse impact on the transfer latency

Losses near the end of the transfer always cost at least a retransmit timeout

Losses in the middle may or may not hurt, depending on congestion window size at the time of the loss

Page 36: CPSC 601.381 Tutorial: TCP 101 r The Transmission Control Protocol (TCP) is the protocol that sends your data reliably r Used for email, Web, ftp, telnet,

CPSC 601.38 36

Congratulations!

You are now a TCP expert!