问题
Heroku doesn't offer auto-scaling for anything under the "performance tier" dynos ($250/mo).
Hirefire used to be a gem that you could configure to autoscale dynos, but they realized that their solution could make money so now it's a paid service.
What options are there (including rolling my own) for smaller apps to have intelligent scaling of dynos at no extra cost?
回答1:
The cheapest solution in term of money, but at the cost of time would be to use Heroku's Platform API. The formation endpoint will let you scale up and down the number of dynos.
Then, you "just" need to gather information on how many dynos you need. For example, with the log-runtime-metrics feature and a log drain, you could listen for the cpu and memory usage on your dynos and scale up/down based on that.
来源:https://stackoverflow.com/questions/53177060/how-can-i-roll-my-own-auto-scaling-on-heroku