Scaling your App on a Schedule

Rails Autoscale is all about automatically determining the best times to scale up and down. Or rare occasions, though, it makes sense to schedule certain scaling needs in advance. A few examples…

  • You want a minimum of two dynos (for redundancy) during the week, but scaling down to a single dyno is okay on the weekends.
  • You want to effectively “pause” upscales overnight when you don’t expect any real usage.
  • You have a weekly newsletter that drives a large, sudden, and predicatable spike of traffic to your app, and you want to “pre-scale” for this event.

You can handle these scenarios by adding a “custom autoscaling schedule”.

Scheduled Autoscaling in Action

What is a custom autoscaling schedule?

Your autoscale range is typically a static range. For example, a range of 2-9 dynos would allow autoscaling down to 2 dynos and up to 9 dynos, but never beyond that range.

Static autoscale range

An autoscaling schedule lets you have different autoscale ranges based on day and time. Here’s an example of a schedule that effectively disables autoscaling (by having a fixed 2-2 range) during the early morning hours in North America.

Autoscaling disabled overnight

You can add as many scheduled ranges as you want. The schedule below has a custom range for each day of the week, and you can see which range is currently active.

Autoscaling customized for each day of the week

Spanning multiple days

When you want an autoscale range to span multiple days, you can do so with multiple scheduled ranges. Here’s an example that starts on Friday and ends on Sunday.

Scheduled autoscaling spanning multiple days

When one schedule ends at EOD (end of day) and another begins at 00:00 the next day, it’s treated as a single continual range.

Removing scheduled autoscaling

To go back to a static autoscaling range, remove each of your scheduled ranges, and click “Save”.

Removing your autoscale schedule