-
-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabling/disabling TCP_NODELAY #383
Comments
Write a custom |
Is it desirable to expose a method for this? Lot of consumers probably want Nagle's off. |
I set it by But really think it's not convenient. |
Right but why should my library expose a method when you can already do this at a deeper level by passing a custom net.Listener to http.Server or ConnState like @lesismal suggested. Maybe in the future it'll be possible simply as a result of me allowing direct access to the *net.Conn, see #331 |
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)
onnet.TCPConn
to configure theTCP_NODELAY
option. Since this library usesnet/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.The text was updated successfully, but these errors were encountered: