Initialize a single reqwest::Client
for the server process
#1682
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.
A
reqwest::Client
represents a pool of connections and should bereused. For the
server
andrender-readme
binaries, a single poolis now used for all requests.
This should reduce allocation activity in production for routes that
make an outgoing HTTP connection. Each initialization costs 30,255
allocations and 2.0 MB of allocated data. This work is also done on a
new thread which will map it to a random jemalloc arena. The
initialization is now done once when the server is booted and any
remaining per-request allocations will occur on a smaller thread pool.
This also cleans up how proxying is implemented when running tests.
Previously, the configuration was stored in the S3
Uploader
but thisresulted in test failures when calling functions (i.e.
crate_location
and
readme_location
) that do not make an HTTP request.