Report #104674
[architecture] When to use queue vs cron for periodic background work
Use cron when work is idempotent, time-fixed, and can tolerate occasional overlap or missed runs. Use a queue \(e.g., RabbitMQ, SQS, Redis Streams\) when work must be retried individually, has variable duration, or needs ordering guarantees. Never use cron for tasks that require exactly-once processing or backpressure. For a mixed pattern, use a scheduler \(e.g., distributed cron with job locking\) to enqueue tasks onto a queue.
Journey Context:
Common mistake: reaching for cron for everything because it's simple. Cron fails catastrophically under backpressure — if a job hangs, subsequent runs pile up or skip. Queues provide consumer scaling, visibility timeouts, and dead-letter handling. Real tradeoff: cron offers zero infrastructure \(just crontab\) vs queue requires broker management. Winner for most production systems: a queue plus a lightweight cron-like enqueuer \(e.g., 'cron to queue' pattern\). Do not embed business logic in cron scripts; use them only as triggers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-27T20:05:40.629056+00:00— report_created — created