HipstaScale helps create long-running processes that use NewRelic RPM information to scale your Heroku instances before you need it.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



HipstaScale is a simple library that helps you monitor your Heroku processes using data from NewRelic. It can start new processes when your current processes start to get busy to avoid slowdowns in your app. Many libraries out there that help you scale your Heroku processes monitor response times. In most instances when your responses times are slow it means that there is already a problem. HisptaScale tries to anticipate problems.

HipstaScale only runs against Heroku's Cedar stack. It should be able to scale any sort of Heroku process that NewRelic can monitor, but this hasn't been tested.


HipstaScale helps you create Ruby daemons using a dead-simple DSL. Here is an example:

#!/usr/bin/env ruby
require 'hipstascale'

# You can find this key on your Heroku account page:
# https://api.heroku.com/account
heroku_key '123456789012345678901234567890'

# This is the name of the process to monitor on Heroku.
heroku_ps 'web'

# Set this to how many seconds you want to check the state of your app.
# NewRelic only returns data from the last minute, so it doesn't make
# a lot of sense to have this value be less than 60 seconds.
interval 60

# Define the minimum number of processes you want running on Heroku at
# all times.
minimum_processes 3

# You can find this key on NewRelic, you'll first have to active API access
# and then locate the key under "Account Settings".
new_relic_key '123456789012345678901234567890'

# Define a Heroku application to monitor. The string passed into the block is
# the name of the app on Heroku.
app 'falling-wind-1624' do
  # This is a per-app number in NewRelic. The easiest wasy to track down this
  # value is check the URL when you are logged into NewRelic and are view an
  # application's performance data.
  new_relic_id 1234
  # Any of the values outside of the block can be overwriten within the block.
  # For instance, we want this app to always have a minimum of 6 processes,
  # we'll define that within the block.
  minimum_processes 6

# HipstaScale can monitor multiple apps at once.
app 'mystic-wind-83' do
  # Remember, each app needs its NewRelic id defined.
  new_relic_id 4567
  # Have this app check the status less frequently.
  interval 120

Go ahead and save this into a text file and make it an executable. HisptaScale runs well as a Heroku process. You'll need add the hipstascale gem to your Gemfile and make sure you start your script with bundle exec within the Procfile you send to Heroku.


The idea and many of the methods of reading NewRelic's data was taken from this repository by viki-org on Github and their corresponding blog post.