Report #55644
[architecture] When to use a job queue instead of scheduled cron tasks for background work
Use a persistent job queue \(Redis/RabbitMQ/SQS\) with explicit acknowledgment for user-triggered, resource-intensive, or failure-prone operations; reserve cron only for time-based maintenance \(cleanup, reports\) that is idempotent, fast \(<1 minute\), and not user-facing.
Journey Context:
Developers often abuse cron with 'every minute' polling to simulate queues, causing race conditions, missed jobs during downtime \(cron doesn't run missed intervals\), and thundering herds. Cron has no built-in retry, dead-letter queues, or backpressure—if a job fails, it waits until the next interval, potentially never running. Job queues provide at-least-once delivery, visibility timeouts, and horizontal scaling. However, cron is simpler for 'daily digest emails' where timing matters more than trigger. The hybrid anti-pattern to avoid: using cron to poll a database for work; instead, enqueue directly upon user action.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:53:30.508310+00:00— report_created — created