Jeff Kreeftmeijer

Managing Heroku's workers with HireFire@meskyanichi

2011-05-25

As you are most certainly already aware, Heroku is a platform dedicated to hosting Ruby (or Rack) applications. One of the reasons you might consider Heroku is when you:

Heroku also provides add-ons that hook up internal, and 3rd party services with your application automatically!

As appealing as it sounds, in the short run you’ll find yourself spending a lot of money on resources which you would otherwise get a lot cheaper elsewhere, like with VPS or dedicated hosting.

One of those resources, is the Heroku Worker.

When you run a large business, generating plenty of income, such things matter less. However, when you have a bunch of small-medium web applications, be it startups, clients or personal sites, it becomes quite expensive early on for applications that don’t generate (enough) monthly revenue to pay such fees.

Enter: HireFire – The Heroku Worker Manager

A while back I released HireFire, an open source RubyGem to address this issue. As the title suggests, HireFire monitors and manages your applications on Heroku. It will shut down workers when there aren’t any jobs, and will then spin up new ones again when jobs get enqueued. This can save you a significant amount of money since workers will no longer run full-time. Not only that, but it’ll also enable you to process jobs at a higher concurrency because of the ability to automatically scale up and down.

It has been working great, but since the performance and reliability of my open source solution didn’t quite cut it, due to Heroku’s platform limitations, I decided to release it as a hosted service. I gave it a nice interface for easily defining how you want to scale your workers. For example, you could configure it to spin up two workers when the queue size hits 15, and four workers when the queue size hits 30, and so forth. This is nice because you can configure it based on how long the average job of your application takes.

If you want to give it a try, head over to HireFire and set up your worker manager. If you have any questions, check out the knowledge base or post a comment below.