Commit b2a449c
fix(network): TCP_NODELAY on every wire connection (Nagle off)
The OpenADS wire protocol is strict ping-pong: 1 client request
→ 1 server response per ABI call. With Nagle's algorithm on
(the kernel default), small frames accumulate up to ~40-200 ms
before the kernel actually flushes them. On a 20-RTT xbrowse
PgDn that's 800 ms of pure scheduler-induced delay even after
M12.17/18/19 collapsed the wire-call count to its theoretical
minimum.
Disable Nagle right after accept() and connect() succeed on
both platform sockets:
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on))
POSIX side picks up the matching <netinet/tcp.h> include.
Listener socket is unaffected; we only flip the per-connection
sockets, where the latency cost actually lives.
No protocol change. Existing 368 / 368 unit tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bef7ce3 commit b2a449c
2 files changed
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
63 | 74 | | |
64 | 75 | | |
65 | 76 | | |
| |||
68 | 79 | | |
69 | 80 | | |
70 | 81 | | |
| 82 | + | |
71 | 83 | | |
72 | 84 | | |
73 | 85 | | |
| |||
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
| 102 | + | |
90 | 103 | | |
91 | 104 | | |
92 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
| |||
93 | 105 | | |
94 | 106 | | |
95 | 107 | | |
| 108 | + | |
96 | 109 | | |
97 | 110 | | |
98 | 111 | | |
| |||
115 | 128 | | |
116 | 129 | | |
117 | 130 | | |
| 131 | + | |
118 | 132 | | |
119 | 133 | | |
120 | 134 | | |
| |||
0 commit comments