perf(node-http-handler): cache 100-continue agents at module level#1986
Open
trivikr wants to merge 2 commits into
Open
perf(node-http-handler): cache 100-continue agents at module level#1986trivikr wants to merge 2 commits into
trivikr wants to merge 2 commits into
Conversation
kuhe
requested changes
Apr 29, 2026
Contributor
kuhe
left a comment
There was a problem hiding this comment.
reusing an agent could resurface the bug that originally necessitated creating a new agent.
We should prove that the original issue (internal repro is available) is fixed before merging this change.
If it is fixed, creating a separate agent may be unnecessary to begin with.
In any case this is partially mitigated by the byte length check before enabling 100-continue in S3.
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.
Issue #, if available:
Improving HttpHandler performance before benchmarking with undici handler
Description of changes:
Replaces per-request Agent creation for 100-continue requests with lazily initialized module-level singletons.
Workloads that send many 100-continue requests (e.g., S3 PutObject) were creating a new Agent per request, causing significant GC pressure. A single cached agent per protocol (HTTP/HTTPS) is now reused across all handler instances.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.