Founder & President

Heroku-scaler: An open source tool for scaling Heroku web dynos on a schedule

Heroku is a great tool for hosting web applications. At Foraker Labs, we build web and mobile apps using tools like Ruby on Rails. Heroku is a fantastic place for hosting Ruby on Rails applications or the infrastructure (like APIs) for mobile apps. Heroku is fast and easy to deploy to and takes the stress and effort out of making sure the hosting platform is secure and redundant. It makes DevOps work easy, which allows software developers to focus on what they love most–building great applications.

One of the primary complaints with Heroku is that it can become expensive as the hosting horsepower needs increase. Of course, we can build a less expensive hosting infrastructure directly on a cloud hosting platform like Amazon Web Services (AWS), but building directly on top of AWS means that we are now in charge of security updates, backups, and other DevOps tasks. How can we have our cake and eat it too?

Only use what you need

Heroku charges for most of its services by the minute. At Foraker Labs, we often have client products that don’t need peak resources all day long. For example, a typical custom business system is used primarily during the 9-5 normal workday. Ah hah! How about we only use the increased resources when we have those peak demands. There are services on Heroku that do this but I have found two problems:

  1. They don’t seem to work very well
  2. They cost money which defeats, to some degree, the benefits of scaling in the first place

Being a control freak

Naturally, as someone who likes to be in control and also likes to build things, I figured we could just build our own. Heroku has a great platform API and a convenient Ruby gem to easily access that API.

Enter Heroku Scaler

We have created the Heroku Scaler to give you control of scaling Heroku web dynos. Using the free Heroku Scheduler you can set up Rake tasks to scale your web dynos up and down at specific times. For example, you might:

This would allow your daytime users to enjoy increased performance but only pay for those resources during 10 hours of the day instead of all 24 hours.

How to use Heroku Scaler

The git repository has more detailed instructions for installing and using the Heroku Scaler but the basic idea is:

  1. Add the heroku-scaler gem to your Rails project
  2. Generate a Heroku API key
  3. Set the Heroku configuration options
  4. Install and configure the Heroku Scheduler

Want to contribute?

Foraker Labs loves open source. If you do too and want to make the Heroku Scaler better, please fork the git repository and submit a pull request.

What do you think?

Have questions, comments, or other ideas? Please find me @stirlingolson on Twitter.

Tweet at Stirling

Share this post!