Description
Some applications will benefit from being able to enable tcp::no_delay
as well as QUICKACK
within both the client (http_client_asio.cpp
) and listener (http_server_asio.cpp
).
I have previously opened #1189. And I think this should potentially address #468 (This actually does mention enabling tcp::no_delay
by someone recently.
I was previously experiencing horrendous RTT (roughly 100ms - 400ms+). Applying this on the client (both client and server use cpprestsdk) saw an improvement where now the average is 70ms RTT. I am still doing some experiments to see why this isn't lower, but this is a marked improvement because server profiling showed I was being blocked and hence "server CPU time" was more or less the RTT. Now, the "server CPU time" is roughly 4ms. So that in itself is dramatic.
Note that from my initial testing, the client side seems more important. Yet I'm still also indicating we allow this enabled on the listeners as well. I am by no means claiming to be an expert on this. I am only suggesting the ability to enable on the listener for parity and to allow for easier experimentation.
Ideally I wanted to create a wrapper handler in asio_connection
's async_connect
. This way anyone calling async_connect
would have this automatically applied. However I could not get the syntax correct, so I ended up putting the code directly in the calling functions' handlers. Does anyone know how to properly create an "intermediary" handler so this could be more cleanly done?
I have a branch with my changes. Note this forces it into this mode. The clean solution is to make this optional. But if anyone wants to test for timings to help see if this reduces some performance issues, that would be awesome.
https://github.com/mobileben/cpprestsdk/tree/nagle-quickack
Note the "nagle" in the branch name is a little misleading. This ends up disabling Nagle by enabling tcp::no_delay
.