How does one autoscale web dynos on Heroku?

Christian Fazzini picture Christian Fazzini · Feb 7, 2012 · Viewed 10.2k times · Source

With Heroku, how does one AUTO scale up in terms of web dynos when it is needed? Say we get a surge of 100 concurrent users every 2-3 minutes. If our app is stuck on 5-6 web dynos. We are screwed.

Second, I wouldn't be able to monitor traffic 24 hours to determine whether a scale up or down is required.

So far, I've seen http://hirefireapp.com/ and http://www.heroscale.com/ Any suggestions about these two?

Answer

Neil Middleton picture Neil Middleton · Feb 7, 2012

The reason heroku don't do this natively is that it's an incredibly complex problem to solve.

For instance, imagine your scenario above, you suddenly start seeing a queue forming and want to ramp the dynos. You crank on ten more. However, it's not a dyno problem, your database is running slow, so now you've got more dynos all sat waiting for the database which now has even more demand placed on it.

Whilst there are auto-scaling products out there, I've not tried any of them, and fully believe that at the moment only a human can make the correct call on scaling. Your mileage may vary.

I have found in the past that setting the resources to an expected usage level (which may be above the current usage) tends to work best, excluding massive traffic influx (such as being on Hacker News etc)