Description
TCP sockets in Go have the TCP_NODELAY
socket option set by default. This disables Nagle's algorithm which intends to reduce tinygrams by introducing small delays and aggregating them together into larger TCP packets.
This is appropriate for applications running in datacenters with low latency/low jitter network connections, but for an application connecting to an Internet service from a laptop, it's not so good.
https://withinboredom.info/blog/2022/12/29/golang-is-evil-on-shitty-networks/
You can call SetNoDelay(bool)
on net.TCPConn
to configure the TCP_NODELAY
option. Since this library uses net/http
, I'm sure there's a way to call this on the underlying connection, but I couldn't see how from having a brief look. I'll post any findings here.