HerokuMarc SibsonProblem & solution
Hello RedBeat: A New Celery Beat Scheduler
Summary
Heroku Connect relied on Celery Beat to trigger frequent periodic tasks while synchronizing Salesforce and Heroku Postgres data, but the default file-based scheduler developed intermittent pauses and hangs that required manual intervention. Existing SQL-backed scheduling introduced blocked transactions and pauses from periodically saving and reloading the full schedule, while an existing Redis-backed package retained similar reload behavior. RedBeat moves the active schedule and runtime metadata into Redis, allowing updates through Redis keys that Beat reads on its next tick without pausing or reloading. It also uses a lock to prevent concurrent Beat daemons, supports schedule updates from other languages, and has run in production for more than a year without recurring scheduler-related incidents.
Context
Heroku Connect’s growing reliance on Celery Beat for frequent periodic tasks exposed intermittent pauses and hangs. The default file-based scheduler was difficult to use with ephemeral cloud servers, while SQL-backed scheduling caused blocked transactions and full-schedule save and reload pauses.
Approach / What changed
RedBeat stores the active Celery schedule and runtime metadata in Redis. Schedule changes update Redis keys that Beat reads on its next tick, avoiding pauses and full reloads. It also includes a lock to prevent multiple RedBeat daemons from running concurrently.
Takeaways
RedBeat updates the active schedule in Redis, so Celery Beat can pick up changes on its next tick without pausing and reloading the full schedule.
A Redis-backed schedule avoids sharing a filesystem across machines for task metadata and provides a steady, predictable Redis load instead of database load spikes during startup and shutdown.
RedBeat includes a lock that prevents multiple scheduler daemons from running concurrently, addressing an issue that can occur during scaling or development.
Source and freshness
- Source
- heroku.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.