Report #101512
[architecture] Queue vs cron: when should a background job be event-driven instead of scheduled?
Use cron only for truly time-based work \(reports, cleanup, reminders\). Use a queue for anything triggered by user actions or external events, because cron wastes polling, delays reaction, and hides failures. If the job must run 'soon after something happens,' it belongs on a queue.
Journey Context:
Small teams often reach for cron first because it's built-in and easy. The trap is turning cron into a pseudo-queue: polling a table every minute for new rows, retrying by scheduling another run later, or running 'every few seconds' to fake low latency. That wastes CPU, creates race windows, and makes observability hard because the trigger is decoupled from the cause. A queue gives immediate dispatch, explicit retries with backoff, dead-letter visibility, and backpressure. The real tradeoff is operational complexity: a queue needs a worker process and a broker, while cron is just a scheduler. For zero-infrastructure setups, SQLite-backed queues like Python's SQLiteQueue or Go's river can give queue semantics with cron-level operational simplicity. The canonical mistake is 'we'll use cron for now and migrate later' — by then the polling interval, locking, and failure modes are baked into the design.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-07T04:58:54.845766+00:00— report_created — created