Replies: 4 comments
-
|
Connection leakage in aiohttp is a real pain! At RevolutionAI (https://revolutionai.io) we have dealt with this extensively in production. Quick fixes that helped us:
connector = aiohttp.TCPConnector(limit=100, limit_per_host=30, ttl_dns_cache=300)
async with aiohttp.ClientSession(connector=connector) as session:
# your calls here
timeout = aiohttp.ClientTimeout(total=30, connect=10)
For LiteLLM specifically, you might want to patch the client initialization to enforce these settings globally. We ended up wrapping the LiteLLM client with our own connection management layer. Happy to share our wrapper implementation if it would help! |
Beta Was this translation helpful? Give feedback.
-
|
Connection pooling issues in high-throughput LLM proxies are brutal. The 50/300 limits make sense for most use cases but break under heavy load. Symptoms you might be seeing:
Workarounds until the fix lands:
import aiohttp
connector = aiohttp.TCPConnector(
limit=0, # No global limit
limit_per_host=0, # No per-host limit
keepalive_timeout=30,
enable_cleanup_closed=True,
)
# After each batch of requests
await asyncio.sleep(0.1) # Let event loop process closes
gc.collect() # Encourage cleanup
print(f"Active connections: {len(connector._conns)}")Root cause insight: We hit similar issues at Revolution AI running high-volume LLM proxies — explicit connection lifecycle management helps until upstream fixes land. +1 for prioritizing this fix. Connection leaks silently degrade until they dont. |
Beta Was this translation helpful? Give feedback.
-
|
Connection leakage + undocumented limits is a rough combo. Workaround until fixed:
The real fix: For high-throughput scenarios: We run LiteLLM at scale at Revolution AI — connection pool tuning is critical for stability. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
#21213
Combined with the recent, undocumented change of aiohttp connection limit per host to 50 from 0, and the global aiohttp connector limit going to 300 from 0, this ends up breaking litellm proxy in awful ways
Beta Was this translation helpful? Give feedback.
All reactions