1
Lecture, November 27, 2002
TCP
Other Internet Protocols; Internet Traffic
Scalability of Virtual Circuit Networks
QoS
2
IPv6flow label
payload length (bytes)
0 16 318
version priority
next header hop limit
128-bit source IP address
128-bit destination IP address
Payload
3
UDP
payload
0 16 318
source port
checksum length
destination port
4
TCP
Supports:Error control. For each segment:
Sequence numbers.Acknowledgment.TimeoutExample – stop and wait protocol. Very inefficient.Window based
Flow ControlCongestion Control
5
(a) no errors orlost PDUs
sender receiver
pdu0
ack0 pdu0
ack0 pdu1
pdu1 ack1
ack1 pdu0
pdu0 ack0
timeout
(detect duplicate)
(d) acknowledment lost
sender sender receiver
(e) duplicate pdu due to premature timeout
(b) lost PDUtime
time
sender receiver
pdu0 pdu0 ack0
timeout
ack0 pdu1
pdu1 pdu1 ack1
ack1 pdu0
sender receiver
pdu0 pdu0 ack0
timeout
ack0 pdu1
pdu1 pdu1 ack1
ack1 pdu0
pdu1(error detected)
(c) PDU in error
pdu0 pdu0 ack0
ack0 pdu1
pdu1 ack1
pdu1 pdu1
ack1 pdu0
pdu0
pdu0
receiver
ack0 ack0
pdu0
pdu1 pdu1 ack1
timeout
ack1 pdu1
pdu1(detect duplicate) pdu0
ack0 pdu0 ack1
6
TCP
options
acknowledgment number
destination port
payload
0 16 318
source port
sequence number
flags
checksum urgent pointer
advertized windowheaderlength
0
7
TCP 1 bit flagsACK – when set the ack value is valid
SYN, RST, FIN – used for connection establishment and tear-down
PUSH – data should be passed to the upper layer immediately.
URG – there is urgent information in the data
8
Data streaming. MSS- maximum segment size
0 536 1072 1608 536,000 536,536
segment 1 segment 2 segment 3 segment 1001
tcp hdr segment 3
ip hdr tcp hdr segment 3
576
556
536
9
TCP flow control window
Application
IP
TCP
Application
IP
TCP
lastByteAcknowledged
lastByteSent
lastByteFromApplication
Sender's Window
lastByteToApplication
nextByteExpected
lastByteReceived
Receiver's Window
Sender Receiver
10
SYN, SequenceNumber = c
Client
SYN+ACK, SequenceNumber = s, Acknowledgment=c+1
ACK, Acknowledgment=s+1
Server
data
11
TCP is a connection-oriented protocol for client-server communication
Three-wayhandshake
ClientProcess
Clientsocket
MainThread of
Server Process
Data
Serversocket
Newsocket
NewThread of
Server Process
Internet
12
CLOSED
LISTEN
SYN_SENTSYN_RECVD
ESTABLISHED
FIN_WAIT1
FIN_WAIT2
CLOSING
TIME_WAIT CLOSED
LAST_ACK
CLOSE_WAIT
Active OpenSYN
Close
ClosePassive Open
SendSYNSYN
SYN +ACK
CloseFIN
SYNSYN +ACK
ACK
CloseFIN
FINACK
ACK
FINACK
ACK
Timeout after twosegment lifetimes
ACK
CloseFIN
FINACK
SYN+ACKACK
Send
Receive
13
TCP congestion control
Host centric, feedback-based resource allocation policy.
The congestion control window is affected by the timing of the acknowledgments. A late or missing acknowledgment signals that the network is congested.
14
1
2
3
4
5
6
7
8
9
10
11
12
13
1 2 3 4 5 6 7 8 9 10 11 12
threshold
new threshold
time
timeout occurs
slowstart
window size
congestionavoidance
15
Other Internet protocols
ICMP – used by hosts and routers to exchange network layer information, e.g., error reporting
RIP – Routing Information Protocol
OSPF – Open Shortest Path First Protocol
16
Internet traffic
TCP 90 – 95 % of the Internet traffic 65-75 % of TCP traffic is Web related10 % of TCP traffic is due to News5 % of TCP traffic is due to Email5 % of TCP traffic is due to FTP1 % of TCP traffic is due to Napster
UDP 5 – 10 % of the Internet traffic DNSRealaudiogames
17
Scalability issues with VCs
Assume a router with n input and n output lines of b Gbpsaverage packet size l bytesdetermine the size of the routing table
18
Switch A Switch B
inPort = 6inVC = 9outPort = 2outVC = 13
2
Host a
6
Host b
5
1
inPort = 6inVC = 11outPort = 2outVC = 15
inPort = 5inVC = 4outPort = 1outVC = 9
inPort = 1inVC = 10outPort = 5outVC = 5
inPort = 2inVC = 12outPort = 6outVC = 8
inPort = 2inVC = 14outPort = 6outVC = 10
12 13 1415
8
9
10
11
Updated forwarding table of Switch A.
inPort inVC outPort outVC 2 12 6 8 6 9 2 13 2 14 6 10 6 11 2 15
3 456
Initial forwarding table of Switch B.
inPort inVC outPort outVC 1 8 5 3 5 4 1 9
Updated forwarding table of Switch B.
inPort inVC outPort outVC 1 8 5 3 5 4 1 9 1 10 5 5 5 6 1 11
Initial forwarding table of Switch A.
inPort inVC outPort outVC 2 12 6 8 6 9 2 13
inPort = 5inVC = 6outPort = 1outVC = 11
9
8
11
inPort = 1inVC = 8outPort = 5outVC = 3
22
19
Original Algorithm for Adaptive Retransmission
Measure SampleRTT for each segment/ACK pair Compute weighted average of RTTEstimatedRTT = x EstimatedRTT + (1- x SampleRTT
where 0.8 < 0.9
Set timeout based on EstimatedRTT TimeOut = 2 x EstimatedRTT
20
Karn/Partridge Algorithm
Do not sample RTT when re-transmitting
Double timeout after each retransmission
21
Karn/Partridge Algorithm
Sender SenderReceiver Receiver
Sample RTT
O rig ina l transm ission
R e-transm ission
A cknow ledgm ent
O rig ina l transm ission
A cknow ledgm ent
R e-transm ission
Sample RTT
22
Jacobson/Karels Algorithm
New calculation for average RTTDiff = SampleRTT - EstimatedRTT EstimatedRTT = EstimatedRTT + ( x Deviation = Deviation + (|Diff|- Deviation) where is a fraction between 0 and 1
Consider variance when setting timeout value TimeOut = x EstimatedRTT + x Deviation where = 1 and = 4
Notes algorithm only as good as granularity of clock (500
microseconds on Unix) accurate timeout mechanism important to congestion
control (later)
23
Congestion Control Mechanisms
The sender must perform retransmissions to compensate for lost packets due to buffer overflow.Unneeded retransmissions by the sender due to large delays causes a router to use link bandwidth to forward unneeded copies of a packet.
When a packet is dropped along a path the capacity used used at each upstream routers to forward packets to the point where it was dropped was wasted.
24
Delay/Throughput Tradeoffs Q uality o f S ervice
(D e lay)
Q uantity o f S ervice(Throughput)
25
1
2
3
4
5
6
7
8
9
10
11
12
13
1 2 3 4 5 6 7 8 9 10 11 12
threshold
new threshold
time
timeout occurs
slowstart
window size
congestionavoidance
26
Router with infinite buffer capacity
H ost A
H ost B
R outerinl
inl
outl
inl
outl
C
C/2
C/2
inlC/2
D elay
27
Fairness of TCP congestion mechanism
Equal bandwidthline
Fu ll bandw idthutiliza tion line
Throughput o fconnection 1
Throughput o fconnection 2
R
R
28
Flows and resource allocation
Flow: sequence of packets with a common characteristics
A layer-N flow the common attribute a layer-N attributeAll packets exchanged between two hosts
network layer flow All packets exchanged between two
processes transport layer flow
29
who makes decisions
host-centric
router-centric
basis fordecisions
the needs of the flow
the state of network
how are decisionsenforced
30
Min-max fair bandwidth allocation
Goal: fairness in a best-effort network.
Consider:Unidirectional flowsRouters with infinite buffer space
Link capacity is the only limiting factor.
31
AlgorithmStart with an allocation of zero Mbps for each flow.Increment equally the allocation for each flow until one of the links of the network becomes saturated. Now all the flows passing through the saturated link get an equal fraction of the link capacity.Increment equally the allocation for each flow that does not pass through the first saturated link until a second link becomes saturated. Now all the flows passing through the saturated link get an equal fraction of the link capacity.Continue by incrementing equally the allocations of all flows that do not use a saturated link until all flows use at least one saturated link.
32
QoS in a datagram network?
Packet Classification.
Buffer acceptance algorithms.
Explicit Congestion Notification.
Flow measurements
33
Packet classification
Identify the flow the packet belongs to.
The edge routers may be able to do that.
MPLS – multi protocol label switch. Add an extra header in front of the IP header. Now a router decides the output link based upon the input link and the MPLS header.
34
Buffer acceptance algorithms
Tail Drop.
RED – Random Early Detection
RIO – Random Early Detection with In and Out packet dropping strategies.
35
1.0
maxDropProb
minThr_out maxThr_out
minThr_in maxThr_in
avgQue
minThr_inmaxThr_in
sampleQueueLength
dropProb
low load
maxThr_out minThr_out
low load
medium load
medium load
high load
high load
out
in
(a)
(b)sampleQueueLength
inout
36
Explicit Congestion Notification (ECN)
Routers could prevent congestion by informing the source of the packets when they become lightly congested, but before they start dropping packets.
This strategy is called source quench.
37
Source quench
A router sets a congestion notification flag in the IP header to inform the destination that signs of congestion are visible.
The destination informs the source by setting a flag in the TCP header of segments carrying acknowledgments.
38
Problems with ECN
(1) TCP must be modified to support the new flag.
(2) Routers must be modified to distinguish between ECN-capable flows and those who do not support ECN.
(3) IP must be modified to support the congestion notification flag.
(4) TCP should allow the sender to confirm the congestion notification to the receiver, because acknowledgments could be lost.
39
Flow measurements
How to choose the measurement interval to accommodate bursty traffic?
Token bucket
40
The token bucket filter
Characterized by : (1) A token rate R, and (2) The depth of the bucket, B
Basic idea the sender is allocated tokens at a given rate and can accumulate tokens in the bucket until the bucket is filled. To send a byte the sender must have a token. The maximum burst can be of size B because at most B token can be accumulated.
41
Example
Flow A: generates data at a constant rate of 1 Mbps. Its filter will support a rate of 1 Mbps and a bucket depth of 1 byte,
Flow B: alternates between 0.5 and 2.0 Mbps. Its filter will support a rate of 1 Mbps and a bucket depth of 1 Mbps
Note: a single flow can be described by many token buckets.
42
Example
43
B: maximum bucket capacity
C: current number oftokens in bucket
Token Bucket
Router
Incoming packets Accepted packets
Droppedpackets
Initially: C = B1/r: filling rate of the bucket
During a period of T seconds thenumber of tokens accepted is:T x r.
r: the average rate of incoming flow
The number of packets acceptedduring a period of T seconds is atmost: B + T x r
A packet of length L: - is dropped if L > C - is accepted if L <= C andconsumes L tokens, C = C - L.
buffer
44
Token bucket
L = packet lengthC = # of tokens in the bucket---------------------------------------------------if ( L <= C ) { accept the packet; C = C - L; }else drop the packet;
45
A shaping buffer delays packets that do not confirm to the traffic shape
if ( L <= C ) {
accept the packet;
C = C - L;}
else { /* the packet arrived early, delay it */
while ( C < L ) {
wait; }
transmit the packet;
C = C - L;}
46
Packet Scheduling
PS and GPS – Processor Sharing & Generalized Processor Sharing
Round Robin, Weighted Round Robin
Priority Scheduling
Weighted Fair Queuing – practical version of GPS. Transmits packets in the order of their finishing time.
47
Weighted queuing
1q
2q
l
l
l
l
3q
4q
48
RSVP- Resource Reservation Protocol
Used to establish a path for a flow and reserve resources along the path.
Requirements:Accommodate faults – soft state.Support unicast as well as multicast.
PATH messages issued by sender includes TSpec
RESV messages issued by the receiver includes RSpec
49
RSVP
router R1
router R2
router R3
Sender
Receiver1
2
3 4
5
6
7
8
1,2,3,4 - PATH messages to establish a path from source to destination;5,6,7,8 - RESV messages sent by destination to reserve resources along the path
50
RSVP message
32-bit destination IP address
32-bit source IP address
header checksum
fragment identifier 13-bit fragment offset
protocol=46TTL -time to live
flags
0 16 318
packet length (bytes)ToShlenversion
checksumtype: PATH RESV
flagsversion
= 1
length of RSVP messagereservedSent_TTL
RSVP messageIt consists of one or more RSVP objects. Each objecthas a class number and type, length, and a value.
RSVPmessage
RSVPheader
IPheader
51
RSVP multicast
(1) Connection request
(3) RESV(TSpec,RSpec)
(2) PATH(TSpec)
(1) Connection request
(2) PATH(TSpec)
(3) RESV(TSpec,RSpec)
Routers
Internet
Receiver 1
Receiver 2
Receiver 3
Receiver 4
Sender 1
Sender 2
Router
Router
Router
Router
Router
Router
Router
Router
Router
52
Integrated Services
Support fine-grain QoS for individual flows.
Mechanisms:Specification of flow requirements - FlowspecsAdmission decisionsResource reservation and policingPolicy enforcement
53
Flowspecs
TSpec – specify the traffic characteristics
Rspec – describe services required from network.
54
Admission decisions
Two classes:Guaranteed Services – based upon token
bucketsControlled Load – approximates a best effort
model in a lightly loaded network.
55
Integrated Service Router
Admission Control
Resource Reservation
RoutingRSVP
RSVPMessages
Shaper
Policer
ClassifierDispatcherand Buffer
Acceptance IPpackets
RoutingMessages
IPpackets
56
Differentiated Services
Two classes of trafficRegularPremium
Edge routers mark the packets.
Premium packets enjoy EF – Expedited ForwardingAF – Assured Forwarding