feat(origin): setup http transport config and connection pool#629
Draft
sambhav-jain-16 wants to merge 1 commit into
Draft
feat(origin): setup http transport config and connection pool#629sambhav-jain-16 wants to merge 1 commit into
sambhav-jain-16 wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces a shared *http.Transport builder with YAML-configurable connection pool sizing in utils/httputil, and threads an optional shared http.RoundTripper through the origin blob client (and its chunked upload helpers) via a new WithTransport option and a sendOpt helper that selects between SendTLS, SendTransport, and SendTLSTransport. The new transport is not yet wired into production startup, as called out in the description.
Changes:
- Add
httputil.ConnPoolConfig+NewClientTransportwith sensible defaults (256 idle / 32 per host). - Add
blobclient.WithTransportand asendOpthelper; replace allhttputil.SendTLS(c.tls)call sites inHTTPClientwithsendOpt(c.tls, c.transport). - Propagate the shared transport into
transferClientanduploadClientconstructors and theirstart/patch/commitrequests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| utils/httputil/transport.go | New ConnPoolConfig and NewClientTransport factory for a shareable, pooled HTTP transport. |
| origin/blobclient/client.go | Adds transport field, WithTransport option, and sendOpt helper; routes all request sites through it. |
| origin/blobclient/uploader.go | Adds transport to transferClient/uploadClient and their constructors; propagates it into chunked upload requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
This PR aims to establish the base code for configuring connection pool configs using
http.Transport. These changes are not currently wired up to the actual production code and will be done in a follow-up PRWhy?
To reduce sudden bursts of new connections during a bursty load and to avoid overwhelming the host's listen queue, a connection pool is needed. We are starting with the replication logic b/w origin-origin first.
Testing?
A benchmark will be included in the next PR when the code is wired by replication handlers