Skip to content

Initialize a single reqwest::Client for the server process #1682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2019

Conversation

jtgeibel
Copy link
Member

A reqwest::Client represents a pool of connections and should be
reused. For the server and render-readme binaries, a single pool
is 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 this
resulted in test failures when calling functions (i.e. crate_location
and readme_location) that do not make an HTTP request.

A `reqwest::Client` represents a pool of connections and should be
reused.  For the `server` and `render-readme` binaries, a single pool
is 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 this
resulted in test failures when calling functions (i.e. `crate_location`
and `readme_location`) that do not make an HTTP request.
@sgrif
Copy link
Contributor

sgrif commented Mar 20, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Mar 20, 2019

📌 Commit 96c8559 has been approved by sgrif

@bors
Copy link
Contributor

bors commented Mar 20, 2019

⌛ Testing commit 96c8559 with merge 91e03d3...

bors added a commit that referenced this pull request Mar 20, 2019
Initialize a single `reqwest::Client` for the server process

A `reqwest::Client` represents a pool of connections and should be
reused.  For the `server` and `render-readme` binaries, a single pool
is 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 this
resulted in test failures when calling functions (i.e. `crate_location`
and `readme_location`) that do not make an HTTP request.
@bors
Copy link
Contributor

bors commented Mar 20, 2019

☀️ Test successful - checks-travis
Approved by: sgrif
Pushing 91e03d3 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants