How do I control TCP delayed ACK and delayed sending?
Environment
- Red Hat Enterprise Linux MRG
- Network communication over TCP socket
Issue
- We see 40ms delays in Linux responding to ACKs. Why is this? How do I control it?
- We see small data sends (eg: one byte) delayed over network communication. Why is this? How do I control it?
- Can I set
net.ipv4.tcp_delack_minkernel tubable on RHEL?
Resolution
Delayed acknowledgements
The 40ms delay in responding to ACK is an method built into the Linux IP stack to improve network performance.
When a participant in a TCP conversation has an ACK to send, the participant is acknowledging some data it's received, and it is likely that the participant will have a reply to the data it received. Linux will delay the outgoing ACK by up to 40ms to allow the reply to queue, then send both the reply and the ACK together. This is desirable to sending an ACK and then a reply separately, which will cause overhead on the network.
This is controlled at an application level with the TCP_QUICKACK socket option. See man tcp for further details.
This option needs to be set with setsockopt() after each operation of TCP on a given socket.
Delayed small data transmission
The delay in sending small data is an method built into the Linux IP stack to improve efficiency of TCP/IP.
Under normal operation, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets, which results in poor utilization of the network.
This is controlled at an application level with the TCP_NODELAY socket option. See man tcp for further details.
Kernel tunable net.ipv4.tcp_delack_min
This tunable is not present within RHEL kernels.
This tunable is present withing Red Hat MRG kernels, designated with the kernel-rt prefix, or el5rt/el6rt suffix.
Diagnostic Steps
References:
- http://en.wikipedia.org/wiki/TCP_delayed_acknowledgment
- http://en.wikipedia.org/wiki/Nagle's_algorithm
man tcpman socketman setsockopt
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
