Fix litellm connection pool limiting concurrent_requests#1190
Open
sihyeonn wants to merge 1 commit intohuggingface:mainfrom
Open
Fix litellm connection pool limiting concurrent_requests#1190sihyeonn wants to merge 1 commit intohuggingface:mainfrom
sihyeonn wants to merge 1 commit intohuggingface:mainfrom
Conversation
…efault pool limit Configure litellm's global HTTP client session with connection pool limits matching the user-specified concurrent_requests value, bypassing the default httpx max_connections=100 cap. Fixes huggingface#1100 Signed-off-by: Sihyeon Jang <sihyeon.jang@navercorp.com>
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.
Problem
Setting
concurrent_requestsabove 100 (e.g. 128) doesn't actually increase parallelism to the vLLM server — requests get bottlenecked at 100.The root cause is httpx's default
max_connections=100on its connection pool. Since litellm uses httpx internally forlitellm.completion(), the ThreadPoolExecutor happily spawns 128 threads but they all block waiting for one of the 100 available connections.Fix
Set
litellm.client_sessionwith anhttpx.Clientwhose pool limits matchconfig.concurrent_requests. This is litellm's officially documented approach for providing a custom HTTP session.No new dependencies — httpx is already a transitive dep of litellm.
Testing
Verified locally against a vLLM server with
concurrent_requests: 128; active connections now exceed 100 as expected. Default config (concurrent_requests: 10) works as before.