Skip to content

Commit 23716c7

Browse files
committed
Add max_connections cache_params
1 parent 88e08c9 commit 23716c7

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

docs/my-website/docs/proxy/caching.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,19 @@ curl http://localhost:4000/v1/chat/completions \
958958

959959
</Tabs>
960960

961+
962+
## Redis max_connections
963+
964+
You can set the `max_connections` parameter in your `cache_params` for Redis. This is passed directly to the Redis client and controls the maximum number of simultaneous connections in the pool. If you see errors like `No connection available`, try increasing this value:
965+
966+
```yaml
967+
litellm_settings:
968+
cache: true
969+
cache_params:
970+
type: redis
971+
max_connections: 100
972+
```
973+
961974
## Supported `cache_params` on proxy config.yaml
962975

963976
```yaml
@@ -966,6 +979,7 @@ cache_params:
966979
ttl: Optional[float]
967980
default_in_memory_ttl: Optional[float]
968981
default_in_redis_ttl: Optional[float]
982+
max_connections: Optional[Int]
969983
970984
# Type of cache (options: "local", "redis", "s3")
971985
type: s3

docs/my-website/docs/proxy/config_settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ litellm_settings:
5050
port: 6379 # The port number for the Redis cache. Required if type is "redis".
5151
password: "your_password" # The password for the Redis cache. Required if type is "redis".
5252
namespace: "litellm.caching.caching" # namespace for redis cache
53+
max_connections: 100 # [OPTIONAL] Maximum number of Redis connections. Passed directly to redis-py. Increase if you see 'No connection available' errors under high load.
5354

5455
# Optional - Redis Cluster Settings
5556
redis_startup_nodes: [{"host": "127.0.0.1", "port": "7001"}]

docs/my-website/docs/proxy/db_deadlocks.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,29 @@ LiteLLM emits the following prometheus metrics to monitor the health/status of t
8484
| `litellm_in_memory_spend_update_queue_size` | In-memory aggregate spend values for keys, users, teams, team members, etc.| In-Memory |
8585
| `litellm_redis_spend_update_queue_size` | Redis aggregate spend values for keys, users, teams, etc. | Redis |
8686

87+
88+
## Troubleshooting: Redis Connection Errors
89+
90+
You may see errors like:
91+
92+
```
93+
LiteLLM Redis Caching: async async_increment() - Got exception from REDIS No connection available., Writing value=21
94+
LiteLLM Redis Caching: async set_cache_pipeline() - Got exception from REDIS No connection available., Writing value=None
95+
```
96+
97+
This means all available Redis connections are in use, and LiteLLM cannot obtain a new connection from the pool. This can happen under high load or with many concurrent proxy requests.
98+
99+
**Solution:**
100+
101+
- Increase the `max_connections` parameter in your Redis config section in `proxy_config.yaml` to allow more simultaneous connections. For example:
102+
103+
```yaml
104+
litellm_settings:
105+
cache: True
106+
cache_params:
107+
type: redis
108+
max_connections: 100 # Increase as needed for your traffic
109+
```
110+
111+
Adjust this value based on your expected concurrency and Redis server capacity.
112+

docs/my-website/docs/proxy/load_balancing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ router_settings:
172172
redis_host: <your redis host>
173173
redis_password: <your redis password>
174174
redis_port: 1992
175+
cache_params:
176+
type: redis
177+
max_connections: 100 # maximum Redis connections in the pool; tune based on expected concurrency/load
175178
```
176179
177180
## Router settings on config - routing_strategy, model_group_alias

0 commit comments

Comments
 (0)