Report #51779
[architecture] Choosing between cron jobs and message queues for scheduled or deferred work
Use delayed message queues \(SQS with DelaySeconds, RabbitMQ with TTL\+DLX, or PG advisory locks\) for all deferred work; reserve cron only for triggering the scheduler itself, never for business logic execution.
Journey Context:
Cron creates thundering herds at midnight, hides failures in log files, and cannot scale horizontally without complex leader-election. Queues provide visibility, retries, and dead-lettering. The specific anti-pattern is 'cron polls DB then pushes to queue'—this adds latency and complexity. Instead, use the queue's native delay features: AWS SQS supports up to 15min delays per message; for longer, use DynamoDB TTL or Postgres with SKIP LOCKED. The scheduler should be a simple cron that only wakes up and enqueues the next batch, keeping all retry logic in the queue workers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:24:11.603050+00:00— report_created — created