Config Fixes // TraceLite Bench
Celery Worker Concurrency, Prefetch & Task-Recycle Tuning
Setting CELERY_WORKER_MAX_TASKS_PER_CHILD=500 forces Python worker forks to release fragmented heap memory back to Linux automatically.
Measured GlitchTip & Sentry Telemetry
Python glibc malloc holds freed heap pages after large JSON stacktrace or source-map deserializations. Recycling child worker processes every 300-500 tasks keeps GlitchTip worker RAM flat for months without manual container restarts.
| Subsystem / Signal | Measured Footprint | Operational Impact |
|---|---|---|
| 2 GB VPS Concurrency | CONCURRENCY=2 | ~360 - 520 MB worker RSS |
| 4 GB VPS Concurrency | CONCURRENCY=3 to 4 | ~580 - 880 MB worker RSS |
| 8 GB VPS Concurrency | CONCURRENCY=6 to 8 | ~1.1 - 1.7 GB worker RSS |
Step-by-Step Triage & Compose Remediation
- Disable greedy task prefetching: Set CELERY_WORKER_PREFETCH_MULTIPLIER=1 so workers pull one task at a time.
- Enable automatic child recycling: Set CELERY_WORKER_MAX_TASKS_PER_CHILD=500 (or 300 if parsing large JS source maps).
- Verify active worker RSS: Monitor docker stats after a synthetic 10k-event burst to confirm sawtooth memory release.
CELERY_WORKER_CONCURRENCY=4 CELERY_WORKER_PREFETCH_MULTIPLIER=1 CELERY_WORKER_MAX_TASKS_PER_CHILD=500
Diagnostic FAQ
Does recycling a Celery worker every 500 tasks drop events?
No. The parent Celery supervisor finishes the current task cleanly before spawning a fresh child process.
When should I raise concurrency above 8?
Only when monthly events exceed 12M-25M on 3-4+ vCPU nodes (Vultr HF 8 GB or Hostinger KVM 4).