Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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 for pages to load, increase dynos. Otherwise, go back down.

Anything like that exist?

like image 886
Shpigford Avatar asked Mar 17 '11 14:03

Shpigford


2 Answers

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!

like image 55
Michael van Rooijen Avatar answered Sep 22 '22 15:09

Michael van Rooijen


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

like image 21
genkilabs Avatar answered Sep 18 '22 15:09

genkilabs