[RFC PATCH] tcp: Replace send buffer boost with EPOLLOUT monitoring
Currently we use the SNDBUF boost mechanism to force TCP auto-tuning.
However, it doesn't always work, and sometimes causes a lot of
retransmissions. As a result, the throughput suffers.
This patch replaces it with monitoring EPOLLOUT when sendmsg() failure
(with EAGAIN and EWOULDBLOCK) and partial sends occur.
Tested with iperf3 inside pasta: throughput is now comparable to running
iperf3 directly on the host without pasta. However, retransmissions can
still be elevated when RTT >= 50ms. For example, when RTT is between
200ms and 500ms, retransmission count varies from 30 to 120 in roughly
80% of test runs.
Link: https://bugs.passt.top/show_bug.cgi?id=138
Suggested-by: Stefano Brivio
On Fri, 20 Mar 2026 18:32:14 +0800
Yumei Huang
Currently we use the SNDBUF boost mechanism to force TCP auto-tuning. However, it doesn't always work, and sometimes causes a lot of retransmissions. As a result, the throughput suffers.
This patch replaces it with monitoring EPOLLOUT when sendmsg() failure (with EAGAIN and EWOULDBLOCK) and partial sends occur.
Tested with iperf3 inside pasta: throughput is now comparable to running iperf3 directly on the host without pasta. However, retransmissions can still be elevated when RTT >= 50ms. For example, when RTT is between 200ms and 500ms, retransmission count varies from 30 to 120 in roughly 80% of test runs.
Link: https://bugs.passt.top/show_bug.cgi?id=138 Suggested-by: Stefano Brivio
Signed-off-by: Yumei Huang --- tcp.c | 57 +++++++++++++++++---------------------------------------- 1 file changed, 17 insertions(+), 40 deletions(-)
Thanks a lot! This is definitely a massive improvement, and a much needed simplification over the original, so I applied this as it is (I also tested it quite thoroughly). I'm still looking into how we can replace the 75% to 100% linearly scaled usage factor from tcp_get_sndbuf() with a more accurate calculation (assuming it's doable), as a follow-up change, but even once/if we do that, properly reacting on EPOLLOUT as this patch adds is something we'll need anyway. -- Stefano
participants (2)
-
Stefano Brivio
-
Yumei Huang