sack - Computer and Information Sciences

advertisement
1
CISC 856 – TCP OPTIONS
SELECTIVE ACKNOWLEDGEMENT (SACK)
RFC 2018
DUPLICATE SELECTIVE ACKNOWLEDGMENT
(DSACK)
RFC 2883
Thanks to Dr.Paul Amer and
Pallavi Mahajan
Rajesh Ponnurangam
Computers & Information Sciences
University of Delaware
2
TCP without SACK
• TCP uses cumulative ACKs
• Receiver identifies the last byte of data successfully received
• Out of rrder segments are not ACKed
• Receiver sends duplicate ACKs
• TCP without SACK forces the TCP sender
• Either to wait an RTT to find out a segment was lost
• Or, unnecessarily retransmit data that has been correctly received
• Can result in reduced overall throughput
3
TCP with Selective Ack (SACK)
• SACK + Selective Repeat Retransmission Policy allows
• receiver informs sender about all segments that are successfully received.
• sender fast retransmits only the missing data segments
• SACK is implemented using two TCP Options
• SACK-Permitted Option
• SACK Option
4
SACK-Permitted Option
• Sack–Permitted option
• is allowed only in a SYN Segment.
• indicates sender handles SACKs, and receiver should send SACKs if possible.
• SACK option can be used once connection is established
Source port address
TCP
header
length
Destination port address
Sequence Number
Cumulative Ack No.
1
6
Checksum
SYN bit
TCP Header
kind=4
length=2
SACKpermitted
Window size
Urgent pointer
kind=1
kind=1
NOP
NOP
options
5
SACK-Permitted Option and SACK
RECEIVER
SENDER
TCP
connection
establishment
phase
Source
Sourceport
portaddress
address
Destination
Destinationport
portaddress
address
Source port address
Sequence
Number
SequenceDestination
Number port address
data
transfer
phase
SYN
bit
ACK bit
ACK bit
Sequence Ack
Number
Cumulative
Cumulative
AckNo.
No.
AckWindow
No.
11
size
Window
size
1Cumulative
Window
size
Checksum
Urgent
Checksum
Urgentpointer
pointer
1
Checksum
kind=4
kind=4
length=2
length=2
SACKSACK-
Urgent
kind=1
kind=1
kind=1 pointer
kind=1
kind=1
NOP
NOP
kind=1
NOP
NOP
options
options
6
SACK Option
Source port address
Destination port address
Sequence Number
• Length of SACK with n blocks?
= (2 + 8 * n) bytes
Cumulative Ack No.
HLEN
Window size
Checksum
Kind=1
Kind=1
Urgent pointer
Kind=5 Length=??
Left edge of 1st block
Right edge of 1st block
Left edge of nth block
Right edge of nth block
• Max number bytes available
for TCP Options?
= 40 bytes
• Max number of SACK blocks
possible?
= 4 SACK blocks
(barring no other TCP
Options)
7
SACK Example
receiver’s buffer
receiver
sender
1-100 101-200
1-100 101-200
401-500 501-600
8
SACK Rules
• With SACKs, the ACK field is still a cum ACK
• A SACK cannot be sent unless the SACK-Permitted option has been
received (in the SYN)
• The 1st SACK block MUST specify the contiguous block of data containing
the segment which triggered this acknowledgment
• If SACKs are sent, SACK option should be included in all ACK’s which do
not ACK the highest sequence number in the data receiver’s queue
9
Generating SACKs – data receiver behavior
• If the data receiver has not received a SACK-Permitted Option for a given
connection, the receiver must not send SACK options on that connection
• The receiver should send an ACK for every valid segment that arrives
containing new data
• The data receiver should include as many distinct SACK blocks as possible
in the SACK option
• SACK option should be filled out by repeating the most recently reported
SACK blocks
• The data receiver provides the sender with the most up-to-date info about
the state of the network and the receiver’s queue
10
Interpreting SACKs - Data Sender behavior
• The sender records the SACK for future reference
• Maintains a retransmission queue containing unacknowledged segments
• One possible implementation
• Turns on SACK bit for the segment in retransmission queue when it receives a SACK
• Skips SACKed data during any later fast retransmission
• On fast retransmit, retransmits data not SACKed so far and less than the highest
SACKed data
• Turns off SACK bit after retransmission time out
11
Another SACK Example
Receiver Buffer
100 299
699
300
699
receiver
sender
300 500
500
900
1099
12
Another SACK Example
300
500
699
900
(cont’d)
1099
receiver
sender
300 500
699
900
1099
300 500
700
900
1099
1100
13
Without SACK vs. With SACK
TCP with SACK
TCP without SACK
fast retransmit
receiver
sender
receiver
sender
fast retransmit
14
Data Receiver Reneging
Reneging – fail to fulfill a promise or obligation
• Data receiver is permitted to discard data in its queue that has not been
acknowledged to the data sender, even if the data has already been SACKed
• Such discarding of SACKed segments is discouraged, but may occur if the
receiver must give buffer space back to the OS
• If reneging occurs
• first SACK should reflect the newest segment even if its going to be discarded
• Except for the newest segment, all SACK blocks MUST NOT report any old data
which is no longer actually held by the receiver
15
Reneging Example
100
199
200 300
receiver
sender
200
200
200
399
reneg occurs; window decreases
window increases
500
599
16
Consequences of Reneging
• Sender must maintain normal TCP timeouts
• Data cannot be considered “communicated” until a cum ACK is sent
• Sender must retransmit the data at the left window edge after a retransmit
timeout, even if that data has been SACKed by the receiver
• Sender MUST NOT discard data before being acked by the Cum Ack
17
SACK Observations
• SACK TCP follows standard TCP congestion control; Adding SACK to TCP
does not change the basic underlying congestion control algorithms
• SACK TCP has major advantages when compared TCP Tahoe, Reno, Vegas
and New Reno, as PDUs have been provided with additional information due
to the SACK
• Difference in behavior when multiple packets are dropped from one
window of data
• SACK information allows the sender to better decide what to retransmit and
what not to
Duplicate SACK (D-SACK)
Extension to SACK – RFC 2883
• How is SACK option used when duplicate segments are received?
• D-SACK does not require separate negotiation between a TCP sender
and receiver that have already negotiated SACK
• When D-SACK is used, the first block of the SACK option should be a DSACK block specifying a duplicate segment
• A D-SACK block is only used to report a duplicate contiguous sequence
of data received by the receiver in the most recent segment
• Each duplicate contiguous sequence of data received is reported in at
most one D-SACK block
18
D-SACK Example
Segment replicated by the network
Receiver Buffer
200 399
receiver
sender
400 600
799
400
600
800
999
400
600
800
999
19
20
DSACK – Another example
Receiver Buffer
500 599
1100 1199
600 699
1100
1199
1100
1199
receiver
sender
600
600 699
800
700 800
899
899
1100 1199
21
Interpreting D-SACK - Data Sender Behavior
• The loss of a single ACK can prevent this information from reaching the sender.
• How does sender knows the first SACK block is a D-SACK?
• Compares the sequence space in the 1st SACK block to the cum ACK
• if seq_space < cum_ACK, then duplicate data has been received
• if seq_space > cum_ACK, then sender compares seq_space with the seq_space in 2nd
SACK block (if there is one)
• if the 1st SACK block is reporting duplicate data that lies above the cumulative
ACK, then the 1st SACK block will be a subset of the 2nd SACK block.
22
DSACK Example
TCP with SACK & without D-SACK
cwnd =10
cwnd =10
cwnd =5
cwnd =5
cwnd =5
cwnd =5
cwnd =10
fast retransmit
receiver
sender
fast retransmit
receiver
sender
cwnd =5
TCP with SACK and D-SACK
23
D-SACK and Retransmissions
• D-SACK allows TCP sender to determine when a retransmission was “spurious”
(ie, unnecessary) and then undo congestion control measures
• D-SACK allows TCP sender to determine if the network is duplicating TCP-PDUs
• D-SACK does not allow a sender to determine if both the original and
retransmitted data are received, or the original is lost and the retransmitted data
is duplicated by the network.
24
SACK and D-SACK Interaction
• There is no difference between SACK and D-SACK, except that the first SACK
block is used to report a duplicate segment in D-SACK.
• D-SACK does not require separate negotiation between a TCP sender and
receiver that have already negotiated SACK capability.
• D-SACK is compatible with current implementations of SACK option in TCP.
25
Current Implementations of SACK
• Windows 2000/XP
• Controlled by a registry parameter – SackOpts in
“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Pa
rameters” - SackOpts="1"
• Windows Vista
• Windows Server 2008 and Windows Vista support TCP SACK
• Free BSD and NetBSD have optional modules
• Solaris 7 and later
26
References
• RFC 2018 – TCP Selective Acknowledgement Options.
• RFC 2883 – An Extension to SACK option for TCP.
• Kevin Fall and Sally Floyd, “Simulation-based Comparisons of Tahoe, Reno,
and SACK TCP”, Lawrence Berkley National Laboratory.
Download