mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Addresses three review concerns and adds httpx URL caching: 1. safe_json_dumps.py: Guard orjson import with try/except fallback to stdlib json. This module is on the core SDK import path via _logging.py — unconditional orjson import would break plain 'pip install litellm' (non-proxy) users. 2. router.py print_deployment: Update docstring to accurately describe the reduced return shape (model_name + litellm_params only). 3. run_perf_comparison.sh: Fix locustfile reference to use the correct locustfile_perf.py instead of locustfile.py. 4. httpx URL pre-parsing (~7.8us -> ~0.4us per request, 19x speedup): Add _parse_url() with LRU cache (maxsize=64) that pre-parses URL strings into httpx.URL objects. Applied to all HTTP methods (GET, POST, PUT, PATCH, DELETE) in both AsyncHTTPHandler and HTTPHandler. Eliminates regex-heavy re.finditer inside httpx._urlparse on every request — confirmed as a GIL hotspot in py-spy thread dumps. Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com> |
||
|---|---|---|
| .. | ||
| compare_perf_results.py | ||
| compare_results.py | ||
| loadtest_config.yaml | ||
| loadtest_config_perf.yaml | ||
| loadtest_config_sidecar.yaml | ||
| locustfile.py | ||
| locustfile_perf.py | ||
| memory_leak_utils.py | ||
| mock_openai_server.py | ||
| run_loadtest.sh | ||
| run_perf_comparison.sh | ||
| test_datadog_load_test.py | ||
| test_langsmith_load_test.py | ||
| test_linear_memory_growth.py | ||
| test_memory_usage.py | ||
| test_otel_load_test.py | ||
| test_vertex_embeddings_load_test.py | ||
| test_vertex_load_tests.py | ||
| vertex_key.json | ||