Cost Models // SeatExit FinOps
Redis 7 WebSocket & Multi-Worker Session Memory Model
A capped 192 MB Redis 7 container eliminates dropped token streams and auth desync when running 2-4 Open WebUI Uvicorn workers.
Measured Unit Economics & Telemetry
Without Redis pub/sub, multi-worker Open WebUI deployments fail intermittently when a browser WebSocket reconnects to a different Uvicorn process than the one streaming the LLM response. Adding a lightweight redis:7-alpine container with a strict 192 MB allkeys-lru cap solves state routing for <220 MB total RSS.
| Resource / Billing Line | Audited Value | FinOps Impact |
|---|---|---|
| Redis 7 Alpine Base RSS | ~28 MB | Before active WebSocket pub/sub load |
| Configured maxmemory Cap | 192 MB | Protects host from unbounded cache growth |
| Per-Active User Session Delta | ~1.2 - 1.5 MB | Covers WebSocket buffers + OIDC cache |
| Container mem_limit | 256 MB | 1.6% of a 16 GB KVM 4 node |
Implementation & Configuration Checklist
- Bind Redis on Internal Docker Bridge: Do not expose port 6379 publicly; communicate strictly over the internal compose network.
- Separate DB 0 and DB 1: Point REDIS_URL to /0 and WEBSOCKET_REDIS_URL to /1 for clean key separation.
- Enforce allkeys-lru Eviction: Pass --maxmemory 192mb --maxmemory-policy allkeys-lru in the compose command.
REDIS_URL=redis://redis:6379/0
WEBSOCKET_MANAGER=redis
WEBSOCKET_REDIS_URL=redis://redis:6379/1
REDIS_MAXMEMORY=192mb
Team RAG Infrastructure FAQ
Do we need Redis if UVICORN_WORKERS=1?
A single worker can use in-memory state, but running Redis from day one avoids future refactoring when scaling past 15 seats.
Does Redis store permanent chat history?
No. Chat histories persist in SQLite or PostgreSQL; Redis handles ephemeral WebSocket pub/sub and lock keys.