开发者

Heroku: How can I dynamically scale dynos based on load time?

开发者 https://www.devze.com 2023-02-18 14:10 出处:网络
There are random times throughout the day that my app can have pretty extreme increases in load based on various factors.

There are random times throughout the day that my app can have pretty extreme increases in load based on various factors.

At those times, I'd like to automatically increase the number of dynos.

I'd like to base the increase on the load time. So if it's taking X amount of time f开发者_高级运维or pages to load, increase dynos. Otherwise, go back down.

Anything like that exist?


HireFire is able to auto-scale both your web- and worker dynos based on various metrics. We currently support the following metric sources/types:

  • HireFire (Response Time) | Web Dynos
  • HireFire (Job Queue) | Worker Dynos
  • Heroku Logplex (Response Time) | Web Dynos
  • Heroku Logplex (Requests Per Minute) | Web Dynos
  • Heroku Logplex (Dyno CPU Load) | Web Dynos
  • NewRelic (Apdex) | Web Dynos
  • NewRelic (Response Time) | Web Dynos
  • NewRelic (Requests Per Minute) | Web Dynos

HireFire (Response Time) performs a basic HTTP request to measure response times.

HireFire (Job Queue) allows you to auto-scale your worker dynos based on their queue-sizes. You'll setup a very simple endpoint on your end (we have a RubyGem for this, but it can be done in any language with any library very easily). We'll periodically perform checkups and scale your worker dyno formation accordingly.

New Relic allows you to integrate with New Relic. It'll periodically fetch up-to-date metric data such as Average Response Time, Requests Per Minute and Apdex to determine your web dyno formation.

Heroku Logplex is our latest addition. This approach relies on your (and Heroku's) logs. Your logs will be streamed from Heroku's Logplex to HireFire's Logdrain, where it will be parsed for metric data. This allows you to auto-scale your web dynos in a more reliable way than with HireFire/ResponseTime as it grabs data directly from Heroku's Router. This approach doesn't require any external dependencies such as New Relic either.

Get in touch if you have any questions!


There is a new plug and play addon that just launched for this: https://addons.heroku.com/adept-scale


Seems like heroku-autoscale is a good bet.

0

精彩评论

暂无评论...
验证码 换一张
取 消