Project

burninator

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Plays SELECT queries to your Rails application on a follower database to keep its caches warm.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.13.3

Runtime

>= 3.2.0
~> 3.0.3
 Project Readme

burninator

Code Climate Build Status Gem Version

Status: Stable

Summary

burninator

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 redis parameter, it will create a new connection using what's configured in the environment as REDIS_URL.

  • percentage will default to 5%.

  • If either WARM_TARGET_URL is missing or REDIS_URL is missing and a redis parameter is not provided, a Burninator::EnvironmentError will be raised.

  • broadcast takes an additional parameter ignore which 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.