Skip to content

fix(s3): make the socket pool size configurable and apply it to http endpoints - #14

Closed
chenrui333 wants to merge 2 commits into
review-base/upstream-devfrom
perf/s3-socket-pool
Closed

chenrui333 wants to merge 2 commits into
review-base/upstream-devfrom
perf/s3-socket-pool

Conversation

@chenrui333

Copy link
Copy Markdown
Owner

Review copy of a proposed upstream change, based on falcondev-oss/github-actions-cache-server@dev (6ae06c2). Upstream accepts pull requests from collaborators only, so this branch is offered through an upstream issue.

The S3 client uses one hard-coded 50-socket keep-alive agent and passes it only as httpsAgent, so http:// endpoints (MinIO, RustFS, in-cluster gateways) silently use the SDK default agent. Adds STORAGE_S3_MAX_SOCKETS (default 50), applied to both agents.

…endpoints

The S3 client's agent pool was hard-coded at 50 sockets, and the agent was
passed only as `httpsAgent`. NodeHttpHandler picks the agent by endpoint
scheme, so an http:// endpoint (MinIO, RustFS, an in-cluster gateway)
silently fell back to the SDK's default agent and ignored the configured
pool. Local tests and benchmarks against RustFS therefore never exercised
the pool an https deployment uses.

Add STORAGE_S3_MAX_SOCKETS (default 50, the previous value) and build both
the http and the https agent from the same options.

tests/s3-socket-pool.test.ts holds one GetObject body unread with a pool of
one socket and checks that a second GetObject waits for it; against an
http:// endpoint it did not wait before this change.

Signed-off-by: Rui Chen <rui@chenrui.dev>
@chenrui333

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T21:11:31.351976Z 2e34e04 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d95a8f9268

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/schemas.ts Outdated
'STORAGE_DRIVER': type.unit('s3'),
'STORAGE_S3_BUCKET': 'string',
'STORAGE_S3_SOCKET_TIMEOUT_MS': 'number.integer >= 0 = 10000',
'STORAGE_S3_MAX_SOCKETS': 'number.integer >= 1 = 50',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve socket capacity for streaming merge writes

With STORAGE_S3_MAX_SOCKETS=1, the first download of an unmerged entry containing a sufficiently large Part can stall and fail. The lazy merge in Storage.download() reads Parts through streamParts() while feeding S3Adapter.uploadStream(): the Part's GET holds the only socket, while the multipart uploader needs another connection to initialize/upload the merged object. Once the uploader's buffers fill, backpressure prevents the GET from completing and releasing its socket, so progress stops until a timeout (or indefinitely when socket timeouts are disabled). Reject a pool size of one or separate read/write capacity, and cover a streaming merge rather than only independent GETs.

Useful? React with 👍 / 👎.

A streaming merge holds a part GetObject while its multipart upload waits
for a socket from the same pool, so a pool of one stalls the first restore
of any unmerged entry. Reject it, note in the README that a shared pool
smaller than the number of concurrent merges can stall them, and exercise
the bound with two held reads.

Signed-off-by: Rui Chen <rui@chenrui.dev>
@chenrui333

Copy link
Copy Markdown
Owner Author

Addressed the P2 finding in 2e34e04: STORAGE_S3_MAX_SOCKETS now requires at least 2, the README notes that a shared pool smaller than the number of concurrent merges can stall them (the general fix is the read/write split in #15), and the test holds two reads to fill the pool.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 2e34e04555

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chenrui333

Copy link
Copy Markdown
Owner Author

Superseded by upstream v9.10.0 (falcondev-oss#296).

@chenrui333 chenrui333 closed this Oct 29, 2026
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.

1 participant