Repository navigation
Set TCP_NODELAY on actor node sockets - #206
Merged
Merged
Conversation
Unit Test Results (Linux)333 tests 333 ✅ 24s ⏱️ Results for commit 58a7158. |
Unit Test Results (MacOS)254 tests 254 ✅ 34s ⏱️ Results for commit 58a7158. |
Unit Test Results (Windows)175 tests 175 ✅ 43s ⏱️ Results for commit 58a7158. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Actor nodes exchange many small messages (acks, stream tails). Nagle's algorithm plus delayed ACK can hold a small write behind unacked data, which adds latency on a window round trip. Nothing in coroio set TCP_NODELAY on actor sockets.
What changed:
TSocket::SetNoDelay(): best-effortTCP_NODELAY(POSIX and Windows). It returns false instead of throwing, so a connection already reset by the peer or a non-TCP socket stays usable.TNodecalls it on the outbound socket after the socket factory creates it, before connect.TActorSystem::InboundServecalls it on each accepted socket.test_node_sets_tcp_nodelaychecks the option on a connected node socket. The accepted side is not observable from outside the actor system, so it has no test.Not changed: SO_SNDBUF/SO_RCVBUF. I tried 4 MB on both ends and saw no gain (below). SO_KEEPALIVE is already set for every socket in
TSocketBase::Setup.Measurements (QumirDB, 4 nodes x 4 threads, loopback macOS, with large chunks and a byte window; ABBA order, all results verified):
There is no measurable change on loopback; differences are within 0.5% noise. The option is the standard setting for a message-oriented transport and should matter on a real network or with small windows.
Risk: low. With Nagle off, tiny writes go out as separate packets; the actor transport already batches into large buffers before writing.