Match EvalClient pool to V1 concurrency - #1811
Merged
Merged
Conversation
Contributor
ApprovabilityVerdict: Approved This is a minor configuration change that adjusts HTTP connection pool limits to align with V1 concurrency settings. The change is self-contained, well-commented, and low risk. You can customize Macroscope's approvability policy. Learn more. |
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.
Overview
Align the shared V1
EvalClientHTTP connection pool with the default 128 concurrent rollouts while retaining HTTPX's existing 20-connection idle keepalive bound.Why
V1 can admit 128 rollouts concurrently, but the implicit HTTPX pool admits only 100 active connections. At full default concurrency, the remaining 28 requests wait for a pool slot and form a second latency wave. This change removes that internal queue without making the pool unbounded.
Implementation
Construct the existing
httpx.AsyncClientwithmax_connections=128andmax_keepalive_connections=20. Request timeouts, keepalive expiry, headers, bodies, response parsing, streaming, error handling, and client shutdown remain unchanged.Performance and resources
A local PEP 723 benchmark ran five repetitions of 128 concurrent requests with 500 ms server latency, using fresh processes for each pool configuration.
The measured cost is 1,736,704 additional peak RSS bytes and more concurrently active transport tasks; idle resource retention does not grow.
Note
Low Risk
Single transport tuning knob on the eval relay client; no auth, request shaping, or response handling changes.
Overview
EvalClientnow constructs its sharedhttpx.AsyncClientwith explicithttpx.Limits:max_connections=128(aligned with V1’s default--max-concurrent) andmax_keepalive_connections=20(HTTPX’s default idle cap).Previously the client relied on HTTPX’s implicit 100 active connection limit, so at full default concurrency some upstream eval requests could block waiting for a pool slot instead of running in parallel. Timeouts, headers, relay/streaming behavior, and shutdown are unchanged.
Reviewed by Cursor Bugbot for commit ce0260b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Set explicit connection pool limits on
EvalClientto match V1 concurrencySets
httpx.Limits(max_connections=128, max_keepalive_connections=20)on thehttpx.AsyncClientinEvalClient.__init__, replacing HTTPX's defaults. The 128-connection cap aligns with V1's default concurrency level; the 20 keepalive cap retains HTTPX's built-in bound.Macroscope summarized ce0260b.