4 ms·
As a counter-argument, I've ran into serious issues that were caused by TCP delay being enabled by default, so I ended up disabling it. I actually think having
by PathOfEclipse 4y ago
As a counter-argument, I've ran into serious issues that were caused by TCP delay being enabled by default, so I ended up disabling it. I actually think having it disabled by default is the right choice, assuming you have the control to re-enable it if you need to.
Also, in my opinion, if you want to buffer your writes, then buffer them in the application layer. Don't rely on the kernel to do it for you.
- withinboredom 4y agoI talked a bit about that in the post. Use your own buffers if possible, but there are times you can’t do that reliably (proxies come to mind) where you’d have to basically implement an application specific Nagles algorithm. If you find yourself writing something similar, it’s probably better to let the kernel do it and keep your code simpler to reason about.
- morelisp 4y agoIf you are writing a serious proxy you should be working at either a much lower level (eg splice) or a much higher level (ReadFrom, Copy). If you’re messing around with TCPConn parameters and manual buffer sizes you’ve already lost.
- withinboredom 4y agoNot just network proxies, but possibly proxying/transforming a device i/o (like usb-over-ethernet).
- morelisp 4y agoGoalposts are receding, but this is exactly the higher level I mentioned. Use io.Copy, and if you need any kind of transforms implement them as Readers.
- PathOfEclipse 4y agoI haven't thought about this hard, but, would a proxy not serve it's clients best by being as transparent as possible, meaning to forward packets whenever it receives them from either side? I think this would imply setting no_delay on all proxies by default. If either side of the connection has a delay, then the delay will be honored because the proxy will receive packets later than it would otherwise.
- to11mtm 4y agoIFF you are LAN->LAN or even DC->DC, NoDelay is usually better nowadays. If you are having to retransmit at that level you have far larger problems somewhere else. If you're buffering at the abstracted transport level, Same.
- erik_seaberg 4y agoThe kernel has to buffer everything you send in a sliding window, to retry missed acks. Userspace buffering only reduces syscalls. A lot of people with strong preferences about segment boundaries and timing are arguing with TCP and probably shouldn’t be using it.
- Ferret7446 4y ago> Userspace buffering only reduces syscalls. "only". The kernel also buffers disk writes, but god help you if you're writing files to disk byte by byte.