Open In App

Selective Acknowledgments (SACK) in TCP

Improve
Improve
Like Article
Like
Save
Share
Report

When a packet loss is detected in TCP communication between client and server, the next step is to recover the lost data packet. There are some of the algorithms for loss recovery in TCP. These are: 

  1. Fast Recovery
  2. Selective Acknowledgments (SACK)
  3. Proportional Rate Reduction (PRR)

Limitations of Fast Recovery:

The ‘Fast Recovery’ mechanism in TCP Reno has two major problems. 

  1. Multiple times reduction of the congestion window (cwnd) for the same set of packets. This problem is solved by TCP New Reno.
  2. It takes a lot of time to recover from multiple packets that are lost in the same congestion window. This problem is solved by Selective Acknowledgments (SACK).

Selective Acknowledgments (SACK):

SACK is a sender and receiver side optimization to TCP. Both sender and receiver should support the SACK feature then only it is possible to use this. SACK feature is enabled by default in all operating systems i.e. Linux, Windows, and macOS. SACK does not replace the original ACKs in the TCP header but adds another field in the TCP header’s option field for SACK information. ‘Options’ field in the TCP header is used to send SACKs not the actual ACK field is tempered. A maximum of 32 bytes (out of 40 bytes) can be used for SACK in the ‘Options’ field. 8 bytes in the ‘Options’ field are already reserved for ‘timestamps’.

Working of SACK: 

SACK feature helps the sender to identify ‘gaps’ in the receiver buffer. When the receiver does not receive packets in order then there exist some holes(missing points) in the buffer. SACK helps the sender to know about these holes in the receiver buffer at an early time. When the sender knows about the holes or lost packets, it retransmits them at the same time. Unlike Fast Recovery, SACK does not inform the sender very late about the lost packets.

Working of SACK

Working of SACK

Explanation:

The sender sends packets 0, 1, 2, 3, and 4 at the same time initially. The receiver receives packet-0 and asks for the next-sequenced packet, by sending ACK-1. 

Sender gets ACK-1 and sends packet-5 to maintain cwnd=5.

Packet-1 gets dropped due to network congestion.

The receiver gets packet-2. Sends packet-6 to maintain cwnd=5. Now receiver is getting packets out-of-order. It asks for packet-1 by sending ACK-1 and creates a SACK block for the next required packet. The acknowledgement field will keep on sending duplicate numbers. The receiver sends ACK-1 and SACK 2-3. ACK-1 means the receiver is asking for packet-1. SACK 2-3 means the receiver got packet-2 and asked for packet-3.

Packet=3 gets dropped.

The receiver gets packet-4. Sends packet-7 to maintain cwnd=5. Receiver buffer looks like: [0, 2, 4]. So, there are two holes in its buffer. The receiver sends ACK-1 and SACK 2-3, 4-5. Means receiver has got packet-2 & 4 and asking for packet-3 & 5. Also sends 2nd duplicate ACK-1.

The receiver gets packet=5. The receiver sends ACK-1 and SACK 2-3, 4-6. 
Sender gets 3rd duplicate ACK-1, so it enters fast recovery phase and transmits all lost packets till now at the same time. The receiver is asking for packet-1 and 3.

Loss of packet-1 is conveyed by the ACK field and loss of packet-3 is conveyed by SACK.

The sender retransmits packet-1 and 3. Inflight looks like 6, 7, 1, 3

The receiver receives packet-6 successfully. 

When the receiver gets packet-1. The buffer looks like: [0, 1, 2, 4, 5, 6]. There is still one hole in the buffer.
The receiver sends ACK-3, SACK 4-7. ACK-3 means the receiver has received till packet-2 in order. SACK 4-7 says the receiver got packets 4, 5, and 6 and asking for 7.

When the receiver gets packet-3. The buffer looks like: [0, 1, 2, 3, 4, 5, 6]. Now all the packets have arrived in order. The receiver sends ACK-7 asking for the next packet.

The receiver receives packet-7 successfully and asks for the next packet-8.

SACK in TCP Header:

SACK extension uses ‘two’ TCP options. ‘SACK-Permitted’ option is used with the SYN packet. When the client talks to the server for the very first time at that itself it tells the server that is used SACK. The second option is the ‘SACK’ option, which is used only when the receiver is getting packets out of order. The first option is to let the server know that client supports SACK, in response from server-client will get to know whether the server supports SACK or not.

”SACK-Permitted” option:

Kind=4, Length=2

“SACK-option”:

Kind=5, Length=8*number of SACK blocks.

“SACK-block”:

|Left edge of block of size 4 bytes||| Right edge of block of size 4 bytes|

Every SACK block requires 8 bytes. 4 bytes for the left edge of the block. 4 bytes for the right edge of the block. Edges = sequence numbers that are 32 bits (4 bytes) long. 

SACK Limitation:

A maximum of four SACK blocks can be reported by the receiver in one segment. One SACK block needs 8 bytes, so 8 x 4 SACK blocks = 32 bytes are available for SACK blocks. Because 8 bytes are reserved for the TCP Timestamp Option (Kind = 8, Length = 10). 

8 bytes of TCP Timestamp + 32 bytes of SACK = 40 bytes (total capacity of TCP Options field).

Enhancements to SACK 

  1. Forward Acknowledgment (FACK)
  2. Duplicate Selective Acknowledgment (DSACK)
  3. Recent Acknowledgment (RACK)

Why SACK is Good for Wireless Networks?

SACK is good for wireless networks because wireless networks report multiple packet losses faster. Packet losses and retransmissions are more frequent in a wireless environment. The application at the receiver side need not wait longer for ‘gaps’ to be filled in the receiver buffer.  

SACK minimizes the Flow Completion Time (FCT). Consecutive packet losses can be reported in a single SACK block. SACK improves the performance to a large extent because all packets are retransmitted immediately. The sender can accurately measure the number of packets in flight. It provides a better estimate of the ‘delivery rate’. It is useful for algorithms like Westwood that depend on estimating the ‘data rate’ of a TCP connection.


Last Updated : 08 Aug, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads