add keepalive to http client #623
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The idle connection pool is currently sub-optimial, as it only re-uses connections on an exact match. Specifically, it would be nice if a connection could be re-used if the host:port is a match, but the current implementation also requires the blocking mode to match.
So we potentially still need 4x more connections, but in reality, it's probably more like 2x. Most people are only going to be dealing with TLS traffic, so when you connect to lightpanda.io, you'll need 1 connection for the blocking calls and 1 connections for the nonblocking calls.
For plaintext request, it would be simple to share connections between blocking and nonblocking. But for encrypted requests, we need to dig more into tls.zig and figure out how/if a
tls_clientcan be converted to <-> from blocking to nonblocking (they're different types).