burninator
Status: Stable
Summary

Warm a standby database with some percentage of real production query traffic.
It's common for Heroku customers to have a standby database follower in the event of a primary failure, however if you cutover to that follower and it hasn't yet served any queries you're likely in for a rough time until its SQL and page caches warm up.
Burninator uses a Redis pub/sub channel to broadcast some percentage of query traffic from Rails application servers to a central warming process that will run queries against the follower. It uses the ActiveSupport notifications instrumentation API to listen for queries.
Since your standby is seeing some percentage of real production query traffic, its caches should keep warm and ready for failover.
Requirements
- Rails application (only tested against 3.2.12)
- Ruby 1.9+
- Redis
Installation
Heroku
Set your warm target in the environment
$ heroku config:add WARM_TARGET_URL="postgres://..."
Add the gem in your Gemfile
gem "burninator"
Add config/initializers/burninator.rb
burninator = Burninator.new($redis)
burninator.broadcast(percentage: 25)
If you leave off the
redisparameter, it will create a new connection using what's configured in the environment asREDIS_URL.percentagewill default to 5%.If either
WARM_TARGET_URLis missing orREDIS_URLis missing and aredisparameter is not provided, aBurninator::EnvironmentErrorwill be raised.broadcasttakes an additional parameterignorewhich expects a regular expression. Queries which match this regular expression will not be replayed against the standby database.
Add the process in your Procfile:
burninator: rake burninator:warm
Deploy and start burninating
$ heroku scale burninator=1
License
Please see LICENSE.


