What are Heroku Dynos and How are They Calculated?
Heroku is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. With a verified account on the free plan, you get a pool of 1000 free dyno hours per month alongside many other benefits. Your app will continue to run as long as you have some dyno hours left in your monthly pool.
Recently, I maxed out my dyno hours before the month ended and I wanted to be sure how it's calculated, may be based on traffic, bandwidth or so.
What do this dynos mean, how is the dyno hours calculated and how can I exhaust them?
☝ UI/UX Enthusiast | 💻 Work @MicroFocus | ✍️ Blogger | 👨🏫 Mentor | 🎤 Speaker | 🍟 Foodie
Like many other PaaS providers Heroku also provides the Virtualized Containers that are capable to run your applications. Usually these containers are Unix based and managed by a Container management system. These isolated virtualized containers are called dynos in Heroku world.
Dynos help in scaling your application and you are allowed to chose how many dynos you would like to use for a given application. To scale horizontally, you need more Dynos whereas, to scale vertically you need a bigger(configuration) dynos. Hence it would be purely based on our needs on how do we want to use them.
For Dyno hours calculation I think, heroku uses the logic based on how long dynos were enabled. Generally, if you deploy an application for the first time, Heroku will run 1 web dyno automatically. But if it is an web app, free web dynos sleep after 30 minutes of inactivity and they are wake up only when next request comes. Hence this also gets factored in overall dyno hours you have spent. It is calculated based on the clock hours, as much as I understood.
Here is a point taken from Heroku Dev Center :
Heroku usage is computed from wall-clock time, not CPU time. This means that usage accumulates over time as long as dynos or add-ons are enabled, regardless of traffic or activity.
For example, if you scaled your web dynos to one standard-1x dyno on 2012-01-01 00:00:00 and then scaled your web dynos to zero on 2012-01-01 01:15:30 you would have accrued 01:15:30 dyno hours of usage."
Hope it helps!