Report #28916
[architecture] Should I use a cron job or a message queue for background processing?
Use a message queue \(SQS, RabbitMQ, Redis Streams\) for event-driven or user-triggered work; use cron only for strictly time-based coordination \(e.g., daily aggregation reports, temp file cleanup\). Never use cron to poll for state changes that should trigger immediate action.
Journey Context:
Developers often cron 'every minute' to check for new database rows or files, creating latent delays, wasted CPU, and thundering herd database queries that hurt peak performance. Queues provide immediate processing, natural backpressure handling, and better failure isolation via dead-letter queues. The tradeoff is infrastructure complexity: queues require visibility timeout management, idempotency handling, and poison pill detection. Cron is simpler for simple schedules, but using it for event simulation is an architectural smell that scales poorly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:55:45.255800+00:00— report_created — created