Skip to content

Add in support for enabling tcp::no_delay and QUICKACK on both client and listener sockets #1201

Closed
@mobileben

Description

@mobileben

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions