Skip to main content

Redis Sizing

This page sizes the Redis instance behind LiteLLM Proxy, which you should run as soon as you have more than one gateway instance. Postgres is sized separately in Database Sizing. For how to wire Redis into the proxy, see the Redis section of Production Best Practices and the caching config.

What the proxy asks of Redis​

Redis carries rate limit counters, router and cooldown state, the response cache, and, when use_redis_transaction_buffer is on, the spend update queue. Every one of those is live state with a short lifetime rather than durable history, so Redis is small and latency sensitive rather than large: a working set of a few GB is normal even at high traffic. Treat RAM as headroom for whatever you choose to cache, not as a function of request rate, and treat vCPU count as the thing that governs throughput, since a single Redis process is single threaded and TLS termination competes with command execution on the same core.

Without Redis each instance enforces rate limits independently and cache hits stay local to the instance that served the request, so a fleet of ten pods enforces roughly ten times the limit you configured.

Sizing by request rate​

Sustained RPSvCPURAM
Up to 1K28GB
1K to 5K416GB
5K+8+32GB+

Run Redis 7.0 or newer. Size so that eviction does not happen during normal operation, and prefer adding capacity over relying on an eviction policy: rate limit counters and queued spend updates are live accounting state, so an instance that is evicting under pressure is dropping spend updates and resetting limit windows rather than just losing cache hits. If you use the transaction buffer, enable persistence as well, so a failover does not discard spend updates that were queued but not yet flushed to Postgres.

Above roughly 1000 RPS or 10 instances the buffer is what keeps Postgres from becoming the bottleneck, which makes Redis part of the accounting path rather than an optional cache; see Redis transaction buffer. If you see Got exception from REDIS No connection available under load, raise max_connections in cache_params before reaching for a larger instance, since that error is client-side pool exhaustion rather than a saturated server.

Cloud recommendations​

Use ElastiCache with the Valkey or Redis OSS engine at 7.x or newer on a Graviton node, cache.m7g.large (6.38 GiB) up to 1K RPS and cache.m7g.xlarge (12.93 GiB) above it; the supported node types list usable memory per node, which is below the nominal instance memory, so size against that column rather than the instance name. Run Multi-AZ with automatic failover in production. If you outgrow a single node, prefer cluster mode with LiteLLM's Redis Cluster config over a larger node, since sharding spreads the counter keyspace across processes instead of piling it onto one. ElastiCache Serverless works for plain caching but not for semantic caching on valkey-search, which needs a node-based cluster.

What to monitor​

Watch memory used against maxmemory and the eviction counter, since evictions are silent correctness loss here rather than a cache-hit-rate problem. On the LiteLLM side the useful Prometheus signals are litellm_redis_spend_update_queue_size and litellm_in_memory_spend_update_queue_size for spend updates that are queued rather than written, and litellm_pod_lock_manager_size for which pod currently holds the transaction buffer flush lock. Client connection count matters too: each managed offering caps connections per instance size, and the gateway opens pools per worker.

🚅
LiteLLM Enterprise
SSO/SAML, audit logs, spend tracking, multi-team management, and guardrails — built for production.
Learn more →