Heroku makes it easy to add servers for your app (“dynos” in Heroku lingo). They give you a handy slider on your app dashboard and you simply dial in how many dynos you want.
This is helpful if you notice a spike in activity.
But what if you’re sleeping? (Or you don’t get a notification?)
Autoscaling essentially manages the slider for you. Using a metric such as response time or request queueing time, autoscaling will automatically increase or decrease the number of dynos running for your app.
Heroku offers this in their higher priced tiers ($250+).
If you’re on a lower tier, you’ll need to use an add-on like Rails Autoscale.
When should I add dynos for my Heroku app?
More dynos mean your app can serve more concurrent requests. If you’re seeing increased request queueing times (anything over 50ms), it means you don’t have enough dynos running to serve your current load, and you should add dynos.
This is tedious to do manually, though, and chances are you don’t need those additional dynos 100% of the time. This is why folks choose to autoscale their dynos. It reduces costs while providing peace-of-mind that your app can handle sudden increases in traffic.
For more information, read this article: 4 Ways to Scale on Heroku.
Will adding dynos (scaling up) make my app faster?
Not necessarily. Adding dynos allows your app to serve more concurrent requests. If your app is at capacity (you’re seeing increased request queueing times), then adding dynos will certainly improve response times. If requests are not queueing, though, scaling up will not help your app’s performance.
To truly improve your app performance, you’ll want to use a tool like Scout or New Relic to identify the bottlenecks in your app code. Most often this is caused by excessive or slow database queries.