# LiteLLM + MCP Gateway VPS: 4GB vs 8GB RAM

- Canonical URL: https://nodebudget.dev/specs/litellm-mcp-vps-4gb-vs-8gb-ram-sizing/
- Category: Agent Cost Control
- Updated: 2026-11-30
- Author: Yuanqiang Leng (https://github.com/a895047059)

## Engineering Verdict (TL;DR)
An isolated LiteLLM Proxy + PostgreSQL 16 + Redis 7 + Caddy 2.8 + Progressive MCP Gateway idles near ~687 MB RSS, yet concurrent multi-agent JSON bursts spike memory to ~2.8–3.1 GB. A 2 GB VPS OOM-kills LiteLLM with Exit Code 137; 4 GB RAM + 2 GB swap is the strict solo floor, while 8 GB NVMe RAM is mandatory if you co-host OpenClaw/Hermes, n8n, or Playwright tools on the same box.

## Key Limits
- **Idle Combined RSS**: ~687 MB
- **Burst Concurrent Peak**: ~2.8–3.1 GB
- **Safe VPS Floor**: 4 GB + 2 GB Swap

## Container Memory Allocation & Docker mem_limit Spec (Linux 6.8 KVM)
| Container Service | Idle RSS | Burst Peak | Recommended mem_limit |
| --- | --- | --- | --- |
| Caddy 2.8 (Auto TLS Reverse Proxy) | 28 MB | 65 MB | 128m |
| Redis 7 (--maxmemory 192mb LRU) | 35 MB | 210 MB | 256m |
| PostgreSQL 16 (Spend Ledger) | 64 MB | 380 MB | 512m |
| LiteLLM Proxy (--num_workers 2) | 420 MB | 1,350 MB | 1536m |
| Progressive MCP Gateway (No Browser) | 140 MB | 820 MB | 1024m |
| Optional: OpenClaw/n8n + Playwright | +750 MB | +2,600 MB | Upgrade to 8 GB VPS |

## Real-World Constraints & Tradeoffs
- **Worker count trap**: Setting `--num_workers 4` or `8` on a 4 GB VPS consumes ~1.6 GB at idle before traffic arrives—keep `--num_workers 2` on 4 GB nodes.
- **Docker UFW bypass**: Always bind port 4000 internally on a Docker bridge behind Caddy TLS (`443`), never publish `4000:4000` on `0.0.0.0`.
- **4K fsync disk requirement**: PostgreSQL spend logging stalls on oversold spinning/slow disks—verify >1,500 4K fsync IOPS with `nodebudget-vps-bench` before production rollout.

## Who Should NOT Choose This Setup
Do NOT pay for an 8 GB or 16 GB VPS if you only run LiteLLM + Progressive MCP for 1–2 developers without headless Chromium—a $4–$6/mo 4 GB KVM node with 2 GB swap handles it effortlessly.

## Interactive Calculator & Live Comparison
- Pre-filled calculator: https://nodebudget.dev/tools/mcp-token-overhead-calculator/?srv=15&tps=9&turns=600&cache=65&price=3&vps=8
- Live pricing comparison: https://nodebudget.dev/compare/best-vps-for-openclaw/?pick=openclaw
- Full lab study: https://nodebudget.dev/guides/litellm-mcp-gateway-vps-cut-agent-token-bills/