Skip to main content

Sizing & Scaling

Size the gateway, PostgreSQL, and Redis for the same peak load.

Start with your expected request rate, token volume, and number of concurrent streams. Test with the models and response lengths your applications use. A long stream keeps a connection open even when gateway CPU use is low.

On Kubernetes, add requests per second (RPS) and tokens per second (TPS) to your HPA's CPU and memory targets. See HPA metrics.

Choose a guide​

What you need to decideGuide
Gateway CPU, memory, and worker countSizing and workers
Database compute, storage, and connection limitsDatabase Sizing
Which features need shared stateWhat Needs Redis
Redis memory and connection capacityRedis Sizing
Scale gateway replicas with RPS and TPSAutoscaling
How to reduce database pressure at high trafficHigh-Throughput Deployment
How to send database reads to a replicaDatabase Read Replica
How to tune workers, shutdown, and the serverServer Tuning

Bound the database connections​

Each worker has its own connection pool. Plan for the maximum number of replicas your autoscaler can start:

pool limit × workers per replica × maximum replicas

Leave room for management services, migrations, and other database clients. Use database sizing to set pool and replica limits before you enable autoscaling.

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