Config Fixes // TraceLite Bench
Gunicorn Worker Count & --max-requests Memory Leak Bounds
Locking WEB_CONCURRENCY to 2-4 workers with --max-requests=2000 guarantees predictable web container RAM below 780 MB.
Measured GlitchTip & Sentry Telemetry
Each Gunicorn worker loads the full Django application (~145-195 MB RSS). Bounding worker count to match 2-4 GB VPS budgets prevents silent OOM pressure during concurrent team dashboard browsing and SDK envelope bursts.
| Subsystem / Signal | Measured Footprint | Operational Impact |
|---|---|---|
| 2-4 GB VPS Web Workers | WEB_CONCURRENCY=2 | ~320 - 440 MB total web RSS |
| 8-16 GB VPS Web Workers | WEB_CONCURRENCY=4 | ~640 - 780 MB total web RSS |
| Automatic Recycle Flag | --max-requests=2000 | Prevents multi-week RSS creep |
Step-by-Step Triage & Compose Remediation
- Set WEB_CONCURRENCY explicitly: Override default CPU-based worker scaling in docker-compose.yml.
- Add jittered max-requests: Use --max-requests=2000 --max-requests-jitter=200 so all workers do not restart simultaneously.
- Terminate TLS in Nginx/Caddy: Serve static assets and HTTPS outside Gunicorn for faster response times.
environment: WEB_CONCURRENCY: "2" GUNICORN_CMD_ARGS: "--max-requests=2000 --max-requests-jitter=200"
Diagnostic FAQ
Can 2 Gunicorn workers handle 5M monthly events?
Yes, because /api/store and /envelope requests immediately enqueue into Redis and return 200 OK in milliseconds.
Why include --max-requests-jitter?
Jitter staggers worker recycles so there is never a momentary drop in active Gunicorn processes.