4

we know Nagle's algorithm. Wonder how to change the default 200ms timeout. Is there a way in Linux to set this setting?

2 Answers 2

4

Those 200ms don't come from Nagle's algorithm but delayed ACKs.

You can disable delayed ACKs by using setsocketopt as Mark suggested, or using ip routes, e.g.:

ip route change ROUTE quickack 1

I don't know of any method to set an absolute timeout for delayed ACKs in "normal" (mostly non-realtime) kernels.

3

Nagle's Algorithm prevents small, non-fullsize packets from being sent if there is data in transit which has not yet been acknowledged. Once an acknowledgement of all outstanding data has been received or there is enough new data in the buffer to make a full-sized packet, the new packet will be sent. There is no timeout involved with Nagle's Algorithm.

The behaviour you are describing could either be Delayed Acknowledgement which allows ACKS to be sent for every 2nd packet received. If a 2nd packet is not received within the timeout, an ACK is sent. Or it could be TCP Corking which is similar to Nagle, but rather than waiting indefinitely for an ACK of outstanding data before sending new small packets, TCP Corking will prevent sending a new packet until the buffer has filled or a timeout expires (200ms).

Depending on the distribution of Linux that you are running, you may be able to modify the Delayed Acknowledgement timeout value with sysctl. For example, to reduce the timeout in RHEL:

echo 1 > /proc/sys/net/ipv4/tcp_delack_min

However this option may not be available in other flavours of Linux.

Alternatively, if you have programmatic access, you could modify your application to use TCP_QUICKACK tcp man which would effectively turn off delayed ACK functionality and force the app to send ACKs for every packet received.

TO turn off TCP Corking, you would need to modify your socket calls to set the TCP_CORK parameter - I am not aware of any way to enable this globally.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .