Commit b16b489
tonic: Server::default(): Set TCP_NODELAY to true; improve docs (hyperium#2413)
## Motivation
I recently ran into problems where we accidentally "lost" the
tcp_nodelay=true setting, due to refactoring some code to make it easier
to test. This caused mysterious 40 ms latency increases. I hope this
makes it less likely for others to make this mistake.
## Solution
The documentation of the `Server::tcp_nodelay()` function said "Enabled
by default", but that was only true when using `Server::builder()`. The
`default()` method set this to false. To fix this:
* Change Server::default() to set tcp_nodelay: true.
* Change Server::builder() to just call Server::default().
* Add a test to verify the settings for nodelay and keepalive.
* Document the functions to note that the TCP settings are ignored when
using `serve_with_incoming`. `tcp_keepalive` already had this note. I
added the same documentation to `tcp_nodelay` and to
`serve_with_incoming` so it is less likely to be missed.1 parent 1e1bd8b commit b16b489
1 file changed
+37
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 153 | + | |
158 | 154 | | |
159 | 155 | | |
160 | 156 | | |
| |||
359 | 355 | | |
360 | 356 | | |
361 | 357 | | |
362 | | - | |
| 358 | + | |
363 | 359 | | |
364 | 360 | | |
365 | 361 | | |
| |||
372 | 368 | | |
373 | 369 | | |
374 | 370 | | |
| 371 | + | |
| 372 | + | |
375 | 373 | | |
376 | 374 | | |
377 | 375 | | |
| |||
621 | 619 | | |
622 | 620 | | |
623 | 621 | | |
| 622 | + | |
| 623 | + | |
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
| |||
1170 | 1170 | | |
1171 | 1171 | | |
1172 | 1172 | | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
0 commit comments