Report #15088
[architecture] Deciding between cron jobs and message queues for background processing of user-triggered tasks
Use message queues \(SQS, RabbitMQ, or Redis Streams\) with at-least-once delivery for user-triggered background work \(emails, image processing, PDF generation\); reserve cron jobs exclusively for time-domain logic \(daily billing aggregation, log rotation, temp file cleanup\) that must run regardless of user activity.
Journey Context:
Cron appears operationally simpler \(no infrastructure to manage\), but fails catastrophically for user-facing async work: it offers no per-job retry mechanism \(only whole-batch retry\), no visibility into queue depth or latency, overlapping runs if the previous job hasn't finished \(requiring complex locking\), and no fairness \(one user's bulk upload can block everyone's password reset emails\). Message queues provide dead-letter queues for poison pills, horizontal scaling of workers based on queue length, and natural backpressure. The confusion arises because both 'run later' techniques exist; the distinction is temporal: cron is for 'run at 2 AM daily' while queues are for 'run after user clicks button'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:12:32.489607+00:00— report_created — created