Skip to content

gsocket: Enable TCP_NODELAY by default for stream GSockets

Philip Withnall requested to merge wip/pwithnall/791-disable-nagle into main

TCP_NODELAY disables Nagle’s algorithm, which is generally a better default for modern networks than having it enabled. Nagle’s algorithm delays sending small data blobs until they fill an entire TCP segment, so as to amortise the cost of sending the segment.

This improves bandwidth at the cost of latency. Given the large bandwidth capabilities of most modern networks, most streams are constrained by latency rather than bandwidth, so disabling Nagle’s algorithm makes sense.

Various other major bits of software (such as libcurl) already disable Nagle’s algorithm by default.

Specific applications which need it can turn it back on by calling g_socket_set_option().

Signed-off-by: Philip Withnall pwithnall@gnome.org

Fixes: #791 (closed)

Merge request reports