Rails Autoscale Demo

by adamlogic

GitHub Readme.md

Rails Autoscale Demo App

This is an example Rails application, originally built for testing Rails Autoscale and general experimentation with Puma, Sidekiq, etc. on Heroku.


  • One-click deploy to Heroku
  • Trigger web requests with configurable response time.
  • Trigger background jobs with configurable response time.

Run it locally

  • Clone this repo (or fork it)
  • Install the Heroku CLI
  • Run Postgres and Redis
  • bundle install
  • yarn install
  • rails db:setup
  • heroku local (runs the app on port 5000, use -p to customize)

You'll also need Redis running locally for background jobs.

Deploy it

Just click the button. ✨ A Heroku app will be created and deployed using all free resources.


Once deployed, manually turn on the worker dyno if you want to run background jobs. This isn't done automatically because free worker dynos do not idle, and can accidentally consume all of your free dyno hours if left unattended.

Load test it

Here's an example using the artillery load testing tool.

artillery quick \
  --duration 30 \
  --rate 10 \
  --content-type application/json \
  --payload '{"no_op_request":{"milliseconds":1000,"randomize":0,"strategy":"sleep"}}' \

This example would last 30 seconds, making approximately 10 requests each second. Each request would sleep for 1000ms.

Using the default RAILS_MAX_THREADS=5 and WEB_CONCURRENCY=2, this would push a single dyno to the maximum theoretical concurrent requests (5*2), and you'll likely see increasing request queue times. Changing the strategy to "cpubusy" would _vastly exceed the maximum concurrent requests because multi-threading is ineffective without I/O (or sleep). You'll see quickly spiking request queue times and response times with this strategy.