litellm/litellm-rust/crates/core
Yujong Lee 17bcc04800 perf(rust): bound provider connection pools and adopt mimalloc in the bridge
The four shared reqwest clients (core messages/chat_completions/
audio_transcription, ai-gateway) now set pool_max_idle_per_host(64) and
tcp_keepalive(60s):

- reqwest defaults pool_max_idle_per_host to usize::MAX, so a burst of
  N concurrent calls to one provider host leaves N idle TLS connections
  in the pool after completion, each held until its idle timeout; under
  sustained bursts this grows file descriptors without bound. 64 keeps
  a warm set large enough for handshake-free reuse.
- tcp_keepalive lets silent half-open peers (NAT/LB reaping, vanished
  upstreams) be detected during long streaming responses instead of
  blocking until the 600s full-request timeout.

The python-bridge cdylib now uses mimalloc as its Rust global allocator
(the pydantic-core/orjson pattern). It only governs allocations made by
Rust code in the extension - CPython's pymalloc heap is untouched - but
Rust-side request/response buffering in a long-lived interpreter
process gets mimalloc's sharded free lists and eager page purging
instead of glibc malloc, which favors RSS growth under churn.

No behavior change beyond the socket/allocator characteristics;
timeouts and request paths are untouched.
2026-09-03 10:05:35 -07:00
..
src perf(rust): bound provider connection pools and adopt mimalloc in the bridge 2026-09-03 10:05:35 -07:00
tests refactor(rust): extract domain-neutral Python interop 2026-09-02 12:16:26 -07:00
AGENTS.md refactor(rust): make litellm-core the callable messages() SDK; drop the ai-gateway handler (#35044) 2026-07-29 13:41:31 -07:00
Cargo.toml refactor(python-bridge): split routes and add shared function tracing (#39031) 2026-09-02 16:26:35 -07:00
CLAUDE.md refactor(rust): make litellm-core the callable messages() SDK; drop the ai-gateway handler (#35044) 2026-07-29 13:41:31 -07:00