Simple! Enough to serve every request immediately, and no more.
Okay, maybe not so simple... that sweet spot is really hard to find on your own. You start with a guess, then tweak based on trial and error. That might be okay, except the load on your app is constantly in flux. Your traffic, app performance, and external dependencies (hi, Postgres and Redis!) are all inconsistent.
Don’t try to manage your dynos manually. This is a job to be automated. This is a job for...
Rails Autoscale will (wait for it...) automaticaly scale your app up and down as needed based on a metric. That metric is really important, and it’s where most autoscaling services fall down. Most services only look at response time, but a high response time does not necessarily mean you need more dynos.
You might just have one or two controller actions that are particularly slow (yeah, we all do). Or your external dependencies might be having a momentary hiccup.
In these cases and others, you don’t have a capacity problem, and more dynos will not help!
There’s one metric that does indicate a capacity problem, and that measurement is...
Ah yes, maybe you’ve seen this in New Relic—that lime green strip at the bottom of your performance graph. That’s the time it takes from the moment Heroku receives a request for your app to begin processing it. When this number goes up, it means you have requests waiting to be processed, and your app does not have enough capacity to serve them.
This is when you need to scale up!
Request queueing is the only metric that matters when it comes to scaling dynos, and Rails Autoscale is the only autoscaling solution focused on that metric.
Heroku doesn’t natively expose request queueing because once the Heroku router hands a request off to a dyno, it has no idea when your application begins processing that request – this all happens within your app server (such as Puma or Unicorn). Rails Autoscale provides a tiny Rack middleware that captures this timing and periodically reports it back to the Rails Autoscale service. This is similar to how New Relic works at a fraction of the size.
Rails Autoscale installs in minutes and easily pays for itself. Most businesses save over $50 each month in reduced dyno usage. Even better, they sleep well at night knowing they'll quickly and automatically scale up when needed.
I’m Adam (a.k.a. @adamlogic), the one-man-show behind Rails Autoscale. I built Rails Autoscale in 2016 when I got frustrated with every other autoscaling solution out there. What started as a personal project to solve a problem has evolved into small, growing business. I’ve been a Rails developer since 2007 and a happy Heroku customer for as long as I can remember.
Rails Autoscale is free to try for seven days, just copy & paste the command below to get started. Once the add-on is installed, open it in a browser to complete your setup.
heroku addons:install rails-autoscale
No problem! Send me an email, and I’ll get back to you as soon as I can.