Report #20853
[architecture] When to use cron jobs versus message queues for background processing
Use cron only for strict time-based scheduling \(e.g., 'run at 2 AM daily'\); use message queues for all event-driven or user-triggered background work to ensure reliability, retry logic, and decoupling.
Journey Context:
Teams often default to cron for all background tasks because it's familiar, but this creates 'distributed cron' problems: silent failures, overlapping runs, and no retry mechanisms. The critical distinction is temporal coupling: cron assumes the system cares about \*when\* something runs, while queues assume the system cares about \*guaranteeing\* something runs eventually. If a user clicks 'generate report,' using cron creates a polling loop or timing hacks; a queue provides immediate dispatch with dead-letter queues for debugging. The hard-won insight: cron is for housekeeping \(vacuuming DBs, rotating logs\), queues are for business logic.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:24:35.685419+00:00— report_created — created