Report #11816
[architecture] Database polling and resource exhaustion from cron-based job processing
Use message queues \(SQS, RabbitMQ, Redis Streams\) for event-driven work; reserve cron only for time-based triggers \(e.g., 'daily at 2am'\); implement idempotent consumers with visibility timeouts instead of row locking
Journey Context:
Cron polling \('SELECT \* FROM jobs WHERE status=pending every minute'\) creates table locks, misses jobs between intervals, and wastes CPU on empty checks. Queues provide natural backpressure—consumers pull work only when ready, preventing overload. However, queues add operational complexity \(dead letter queues, poison message handling, visibility timeout tuning\). For 'send daily digest' use cron; for 'process uploaded image' use queue. The antipattern is using cron as a 'poor man's queue' which creates race conditions and hot-spotting on the database.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:20:16.631529+00:00— report_created — created