This add-on is operated by Adept Mobile LLC
Automated Scaling of Heroku dynos
Last updated 07 May 2015
Table of Contents
Adding Adept Scale to an application not only prevents performance degradation from a sharp increases in traffic but can save you money by reducing the number of running web dynos during low-traffic periods.
Adept Scale works by ingesting and processing an application’s syslog drain. With a few parameters found in the settings section, the Adept Scale calculation algorithm will recommend dyno usage and will scale your dynos if necessary.
After initial setup and a period of data collection, the default scale settings can be modified to best suit the needs of an application.
Dyno Types Supported
Adept Scale currently only supports web dynos and has been thoroughly tested on Rails applications on the Cedar Stack.
While we are actively developing a general solution for scaling other kinds of dynos (worker, clock, etc.), our multi-dyno-type build is not yet ready for public use. If you are interested in more information or in being a tester for worker or other dyno scaling for a Rails app, please contact our support email (email@example.com) and tell us about your use case.
Standard add-on installation
To install the add-on run:
$ heroku addons:create adept-scale
Once Adept Scale has been added a syslog drain will be added to your application. You can verify this with the heroku “drains” command.
$ heroku drains -----> [ Adept-scale your-app-name ]
No code setup is needed. Just provision the add-on and go.
You must take 2 important actions before Adept Scale can do its magic:
- Enter your API Key in the account section.
The API Key is needed to execute scaling commands on heroku. We are actively looking into a way around storing your API key.
Your API Key can be found here
- In the account section read the Terms of Service Agreement carefully, check the “I Agree” box and submit the account form.
Once these actions have been completed and the Dyno Scaling setting is turned on, Adept Scale will start auto scaling your application. You may choose to complete these setup steps with the Dyno Scaling setting off to review how Adept Scale interacts with your application dynos without scaling events taking place.
The Adept Scale Dashboard consists of two sections, current and history. The current section displays 2 auto updating, real time graphs that show a recent history of your applications average response time, total request count, dyno usage and dyno recommendations. The history section shows the same data over a 5 minute, 1 hour, 1 day or all time period.
Dyno Recommendations are generated from your settings and application metrics and uses them to scale your app. With the Dyno Scaling setting on, Adept Scale will scale your app to the recommended dyno number.
The dashboard can be accessed via the CLI:
$ heroku addons:open adept-scale Opening adept-scale for sharp-mountain-4005…
or by visiting the Heroku apps web interface, selecting the Adept Scale enabled application and selecting Adept Scale from the Add-ons menu.
Data is currently only stored for 2 days.
Do you want to be informed when your application has spun up 50 dynos for more than an hour? or if your application responds in more than 12000 milliseconds 5 times in an hour? You can setup alerts to send emails when certain events occur over a period of time.
The current metrics you can alert on are:
- a number of dynos running over a time period.
- response times occurring a number of times over a time period.
Upon triggering a rule, Adept Scale can send an email or ping a url. There is also an atom feed that you can subscribe to. The atom feed link can be found at the bottom of the alerts page.
Adept Scale will only send a blank GET request to the ping url. No data is sent.
The settings area provides you with a way to dictate how Adept Scale will react to load on your application. A graph at the top shows a recent history of metrics from you application, where the recommended dynos line is calculated from the settings you provide in the fields below it. With Dyno Scaling on, Adept Scale auto scales your application to the recommended value.
The settings won’t be applied until you submit the settings form.
Depending on the traffic and response times for your application in recent history, the graph may not react to your settings updates. For example, if your application isn’t receiving any traffic then the recommendation will not change.
See the graph in action! Move the expected response time to 5 and sensitivity to 10.
What do these settings mean?
- When Dyno Scaling is on your app will be scaled to match the current Recommendation. When Dyno Scaling is off Adept Scale will continue to recommend dynos but will not scale to those values.
- The low end is the fewest number of dynos you think your app can safely run on. The high end is the largest number of dynos you are willing to pay for. We won’t scale beyond this, we promise.
A current average response time is provided for you. Use this number when deciding an expected response time.
Expected response time
- This is about how long (in milliseconds) your app usually takes to respond, on average. We will use this to determine if more dynos might help so if you are overly optimistic you may end up with more dynos than you need.
- As the algorithm moves across the data set, this value is the number of neighboring data points included in the dyno recommendation calculation. The higher the sample window, the less results will be affected by sharp spikes and troughs in the data. A sample window value of 1 will react to changes much more drastically, where a value of 10 reacts to changes much slower.
Dyno increase rate
- This is how aggressively the recommendation will increase over time. The higher the number the more often dynos will be added.
Dyno decrease rate
- This is how aggressively the recommendation will decrease over time. The higher the number the more often dynos will be removed.
The Account section identifies your application and contains access to tutorials. This section also contains a form with the display timezone and the two setup fields as described in the setup section.
Migrating between plans
Application owners should carefully manage the migration timing to ensure proper application function during the migration process. A list of all plans available can be found here.
heroku addons:upgrade command to migrate to a new plan.
$ heroku addons:upgrade adept-scale:newplan -----> Upgrading adept-scale:newplan to sharp-mountain-4005... done, v18 ($49/mo) Your plan has been updated to: adept-scale:newplan
Removing the add-on
Adept Scale can be removed via the CLI.
This will destroy all associated data and cannot be undone!
$ heroku addons:destroy adept-scale -----> Removing adept-scale from sharp-mountain-4005... done, v20 (free)
After removing the add-on be sure to verify the drain has also been removed with the “heroku drains” command. If the drain is still present, it can be removed manually with:
$ heroku drains:remove drain_name
All Adept Scale support, runtime issues, non-support related issues or product feedback should be submitted via the “Contact” link in the lower right of any authenticated Adept Scale page (http://www.adeptscale.com) or on the top right of the Adept Scale home page.
The current version is 0.8.5 New Features:
- Timezone select in Account
- New user tutorial
- Engine logging and updates