Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Visit the Heroku Blog

    Find news and updates from Heroku in the blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
      • Working with Node.js
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • Working with PHP
      • PHP Behavior in Heroku
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Heroku Inference
      • Quick Start Guides
      • Inference Essentials
      • AI Models
      • Inference API
    • Working with AI
    • Model Context Protocol
    • Vector Database
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Add-ons
  • All Add-ons
  • Dynoscale
Dynoscale

This add-on is operated by Mjolnir Software LLC

Start saving now with smart Auto Scaling for your Web and Worker Heroku Dynos.

Dynoscale

Last updated April 14, 2023

Table of Contents

  • Provisioning the Add-on
  • Language-Specific Integrations
  • Configuration
  • Monitoring and Logging
  • Connect to the Dynoscale Dashboard
  • Troubleshooting
  • Migrating Between Plans
  • Removing the Add-on
  • Support

Dynoscale is an add-on for scaling your web and worker dynos for Rails and Python applications. Dynoscale relies on queue time to scale, not total response time, for more reliable autoscaling.

Autoscaling your application means that your app handles all the traffic in your peak times, but it will also quickly release resources back to Heroku when they aren’t needed, avoiding slowdowns and unnecessary costs.

Dynoscale supports the Ruby and Python languages on Heroku.

Provisioning the Add-on

Attach Dynoscale to a Heroku application via the CLI:

Reference the Dynoscale Elements Page for a list of available plans and regions.

$ heroku addons:create dscale
Creating dscale on sharp-mountain-4005... free
Your add-on has been provisioned successfully

After provisioning Dynoscale, the DYNOSCALE_URL config var is available in the attached app’s configuration. It contains the URL and an account token associated with the application. You can see the config var via the heroku config:get command:

$ heroku config:get DYNOSCALE_URL
https://dynoscale.net/api/v1/report/abcdefg1234

Language-Specific Integrations

Ruby on Rails

You can access Dynoscale via its client libraries for Ruby. Add the following to the Gemfile, specifying the Dynoscale client library.

gem 'dynoscale_ruby'

Update the application dependencies with bundler.

$ bundle install

Once the gem is installed and deployed in a production environment, it sends request queue time data to Dynoscale servers.

Python - WSGI or Gunicorn Hook

You can access Dynoscale via its client libraries for Python. Add dynoscale to your requirements.txt file, then choose how you want to integrate it.

DynoscaleWsgiApp

The following example shows how to wrap your WSGI app:

from flask import Flask
# FIRST, IMPORT DYNOSCALE
from dynoscale.wsgi import DynoscaleWsgiApp

app = Flask(_name__)

@app.route("/")
def index():
    return "Hello from Flask!"

if __name__ == "__main__":
    # THE CHANGE BELOW IS ALL YOU NEED TO DO
    app.wsgi_app = DynoscaleWsgiApp(app.wsgi_app)
    # YUP, WE KNOW, CAN'T GET SIMPLER THAN THAT :)
    app.run(host='127.0.0.1', port=3000, debug=True)

Gunicorn Hook

Import the hook in your gunicorn.conf.py file:

from dynoscale.hooks.gunicorn import pre_request

If you already use the pre_request hook, in which case alias the Dynoscale hook and call it manually:

# Alias the import...
from dynoscale.hooks.gunicorn import pre_request as ds_pre_request

# ...and remember to call ours first!
def pre_request(worker, req):
   ds_pre_request(worker, req)

Configuration

Autoscale Rule

Autoscale rules control over how your application scales under load.

auto scale Rules Navigate to the Web Auto Scale Rules page of the Dynoscale Admin and look at the auto scale rule. Select the blue edit rule button.

Dyno Limits You can find the upper and lower bound for dynos on the upper left side of the rule. These bounds set the maximum and minimum number of dynos this rule will permit. For a low traffic application with some periods of high traffic, begin by setting the lower bound to 1 and the upper bound to 2. You can tune the values over time.

Scaling Thresholds

The Upscale Configuration specifies when to upscale your application. The first field is the request queue threshold. It determines when more dynos are needed to meet the traffic needs of your application. Once the threshold is exceeded, Dynoscale will scale up your application by the increment specified in the next field. Finally, the last field allows you to control how long you want Dynoscale to wait before considering another scaling.

The Downscale Configuration specifies when to downscale your application. The first field is the request queue threshold. It determines when to reduce the dynos needed to meet the traffic needs of your application. Once the request queue drops below the threshold, Dynoscale will scale down your application by an increment set in the next field. Finally, to avoid frequent scaling, the last field delays incremental scale downs with a buffer time.

Saving Select the green save button in the upper right side of the rule. Alternatively, if you don’t want to save changes, select the black cancel button.

Default Autoscale Rules and Other Rules

An application must have a default rule. It dictates how the application should scale when other rules aren’t active. To create another rule, click the “Create Rule” button at the top of the Autoscale Rule page.

Default Rules vs Other Rules

You’ll notice that unlike the default rule, this rule has a dropdown for day of week and fields for start/end times. These fields determine when a rule is active. When rules overlap in time, the topmost rule is selected first.

Reordering Autoscale Rules

Reordering Rules To shift the priority of a rule, you can use the black arrow buttons on the right side of any non-default rule.

Enabling Autoscale Rules

Turn on Autoscale Rules Once you’re happy with the rules, click the toggle on the upper right side of the page. Red indicates that your rules are off and green means your rules are active.

Selecting Worker Autscale Rule Queues

Selecting Queues Worker Auto Scale Rules have slightly different criteria. Most of the Worker Rule fields are the same as the Web Rule fields. One exception is the Queues field, it specifies which queues are applicable for a rule. To ensure a cost-effective usage of auto scaling dynos, make sure to only include queues, which have time sensitive execution.

Monitoring and Logging

Request queue time and dyno scaling for Web and Worker dynos can be monitored via the addon website for logged in users.

Connect to the Dynoscale Dashboard

For more information on the features available within the Dynoscale dashboard, see https://dynoscale.net/documentation.

The Dynoscale dashboard provides details about auto scale rule configuration, dyno queue time and cost savings.

Access the dashboard via the CLI:

$ heroku addons:open dscale
Opening dscale for sharp-mountain-4005

or by visiting the Heroku Dashboard and selecting the application in question. Select Dynoscale from the Add-ons menu.

Troubleshooting

Did I Install the Dynoscale Agent Correctly?

Ruby on Rails Troubleshooting

To install the Dynoscale Agent, follow these instructions. To verify the rails agent installation, run the following Heroku CLI command:

heroku run rails runner 'puts DynoscaleRuby::VERSION'

If the agent is installed successfully, you’ll see the version number of the Dynoscale ruby gem.

Python Troubleshooting

To install the Dynoscale Agent, follow these instructions. To verify the python agent installation, run the following Heroku CLI command:

heroku run python -c 'import dynoscale as ds;print(ds.__version__)'

If the agent is installed successfully, you’ll see the version number of the python Dynoscale package.

Is My Application Sending Queueing Data?

Navigate to the Dashboard page. If you see a sceen like the one below, Dynoscale isn’t receiving your application queuing data. One fix is to trigger an http request to your application.

Sending Queuing Data

Migrating Between Plans

Use the heroku addons:upgrade command to migrate to a new plan. It won’t cause a service disruption to the application.

$ heroku addons:upgrade dscale:performance
-----> Upgrading dscale:performance to sharp-mountain-4005... done, v18 ($249/mo)
       Your plan has been updated to: dscale:performance

Removing the Add-on

Remove Dynoscale via the CLI:

This action destroys all associated data and you can’t undo it!

$ heroku addons:destroy dscale
-----> Removing dscale from sharp-mountain-4005... done, v20 (free)

Support

Submit all Dynoscale support and runtime issues via support@dynoscale.net. Any non-support-related issues or product feedback is welcome by emailing eric@dynoscale.net.

Keep reading

  • All Add-ons

Feedback

Log in to submit feedback.

Zara 4 EasyMovie

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices