Open jackkleeman opened 11 months ago
Hey @jackkleeman, thanks for submitting this issue. We'll add it to our backlog.
I looked at this and came up with a few findings:
nodelay
setting to the HttpConnectorSettings
and HttpConnectorSettingsBuilder
structs.HyperConnectorBuilder::build
.Currently, adding support won't be simple because (afaict) we don't have easy access to the hyper::client::connect::HttpConnector
used in our TLS connector meaning we can't just call HttpConnector::set_nodelay.
One last thing to note: in hyper v1.0, HttpConnector
got moved to hyper-util
.
Yes, given that the Https connector is currently in a lazy static and then just cloned, the only easy thing to do here is to change the default, which I guess is a big decision
As a workaround, users can produce their own https connector by copying and pasting the defaults used by aws, and provide it at config time. Thats how I have fixed it on my end
if you have a snippet could you paste it on this issue? That will be very helpful for other folks looking for the same behavior
Done @rcoh
Describe the feature
The h2 library that backs this SDK seems to put HEADERS and DATA frames into separate TCP packets when payloads are large. That's fine, but in combination with Nagle's algorithm, it means that the second packet containing the DATA frame will not leave the client machine until an ACK is received for the packet containing the HEADERS frame. In my tests this appears to add substantial latency to Lambda invocations. Perhaps on the AWS side there is tcp delayed acknowledgement going on?
This can be resolved by setting SO_NODELAY (this can be set via a method on the hyper HttpConnector). In general this flag reduces latency at the expense of potentially more packets, but in this case it seems to make no difference to the number of packets, but massively reduces latency. In Go this flag defaults to true.
Benchmarks against a hello world Lambda
Use Case
Reducing latency for AWS API calls
Proposed Solution
Either a new config variable, or simply default it to true.
Other Information
As a workaround, you can do this:
Acknowledgements
A note for the community
Community Note