Skip to content
Bela Ban edited this page Oct 1, 2024 · 2 revisions

TCP.tcp_nodelay

This attribute was switched between false and true a couple of times in 5.3.x. Currently (5.3.12 and 5.4), it is false (default in java.net.Socket). When tcp_nodelay is false, Nagling is enabled. This means that smaller segments are sent only when corresponding ACKs have been received (or a timer goes off). When sending many (small or large) messages, performance is better with tcp_nodelay=false.

When sending small messages (under segment size, e.g. 1472 bytes), or having only a few senders, performance is better with tcp_nodelay=true. The best example here is a sender and receiver process in which 1 thread sends and receives requests/responses (e.g. ping-pong). Because latency is crucial, Nagling should be disabled (tcp_nodelay=true) for better round-trip times.

Because most applications use more than 1 sender thread and send larger messages, the default of false is warranted.