Learn More

How to Create a Custom Autoscaling Schedule with Judoscale

Judoscale is all about using metrics to automatically determine when to scale up and down. On 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 “pause” scaling overnight when you don’t expect any real usage.
  • You have a weekly newsletter that drives a large, sudden, and predictable 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.

Create your schedule

Without a schedule in place, you’ll see a simple range slider for your “scale range”. To create a schedule, click the “Create Schedule” button.

Create schedule button

Your schedule is a series of “scale ranges” that apply at different times of the week. Judoscale starts you out with a basic weekday/weekend schedule, but it’s merely a suggestion.

Default schedule

Note that those scale ranges are identical, so right now the schedule isn’t really doing anything—the scale range is the same as it was before, all week long. If all you want is one default scale range for the whole week, you don’t need a schedule. Use “Remove Schedule” to go back to the simple scale range slider.

Customize your schedule

Click on any part of the week to edit that “block”. You can change the day and time for when the block starts, and the scale range that takes effect at that time.

Editing a schedule entry

Time zones

Each schedule is anchored to a time zone. By default, schedules use UTC, but you can change this to any time zone by clicking the “Time Zone Settings” button at the top of the schedule. The schedule time zone is daylight saving time-aware, so your scale ranges will continue to fire at the correct local time when clocks change.

Schedule: Time Zone Settings

The calendar displays times in your local time zone (detected from your browser) by default, but you can configure this for your user in “Time Zone Settings” as well. If your display time zone differs from the schedule time zone, you’ll see both times on each scale range—for example, “10:00 EST (15:00 UTC)"—so you always know exactly when a scale range takes effect.

Your display time zone is a per-user preference. You can update it from User Settings or from the time zone button near the 1/3/7-day filters in the dashboard.

Changing your display time zone does not change schedule behavior. Schedules still fire based on the selected schedule time zone.

If you choose to keep the weekday/weekend schedule, you’ll probably want to adjust the times to match when your users’ weeks typically start and end.

But you can do so much more than just weekdays and weekends!

Create a daily schedule

Let’s say you want to allow scaling down more overnight, while keeping a higher minimum scale during the day. Click the plus icon at the top right of the calendar to add a new scale range.

Add a scale range

In this example we’re reducing our scale range to 1-3 dynos at 21:00 UTC every weekday evening. For a worker process with little to no overnight usage, you might set the minimum to 0 instead. As long as another running process is reporting queue metrics, any new job added to the queue will be reported to Judoscale and we can scale the worker back up to process it.

Note that this only handles the evening scale range. You’ll want to add another daily scale range for the morning.

Daily scale ranges

Here I’ve added another scale range for weekdays at 8:00 UTC to scale back up.

The "weekdays” and “everyday” options for creating scale ranges are convenience methods for creating multiple scale ranges at once. Each day gets its own scale range, so you can still edit any of them on its own.

Editing a weekday scale range

Update or remove matching scale ranges together

When you edit a scale range that has the same time and scale range on other days, Judoscale highlights those matching scale ranges on the calendar. Click “Update all N matching” to apply your change to all of them: move Monday’s 08:00 scale range to 09:00 with a new scale range, and every weekday’s 08:00 scale range moves with it. Click “Remove all N matching” to delete them all at once. Both actions ask you to confirm first.

To change which days a group covers, such as going from weekdays to every day, remove all matching scale ranges and add them again with the new day option.

👀 Note

Scheduled scale ranges work with reactive autoscaling, not against it. When a scale range raises your minimum, Judoscale bumps you up to that minimum immediately—unless you’re already running at or above it. That instant pre-warm is exactly what makes schedules great for getting ahead of a morning traffic ramp or a known spike. When a scale range lowers your minimum, nothing is forced: normal queue-time autoscaling scales you back down to the new floor as traffic subsides. So you really only need a scheduled scale range to raise your floor—reactive autoscaling handles scaling down on its own.

Delete a scale range

Our weekday/weekend scales are redundant now, so we can delete them. To do that, just click on them and click “Delete” in the edit form.

Delete unwanted scale ranges

We now have a clean schedule that scales up each weekday morning and down each weekday evening. And our weekend is still scaled down thanks to our Friday evening scale event.

Weekend is covered

Delete your entire schedule

If you change your mind and decide you don’t need a schedule after all, click “Remove Schedule” to go back to a single scale range slider.

Pre-scaling with a scheduled scale range

A common scenario is a predictable traffic spike. Let’s say you have a newsletter that goes out every Wednesday at 10:00 UTC, and it brings a huge spike in traffic. Metrics-based autoscaling isn’t quite fast enough to handle the spike, and your users experience a slowdown for a few moments. You want to pre-scale so you’re ready for that traffic spike.

You can handle this by scheduling a constrained scale range just before your expected spike. Let’s say you usually autoscale 2-6 dynos during the day, and you want to be running 6 dynos when the spike hits. You could schedule a range of 6-6 dynos (for a fixed scale) or 6-10 dynos (for an immediate upscale plus metrics-based autoscaling) at 9:55 UTC.

Pre-scale for traffic spike

Note that you probably also want to scale back down after a short while, otherwise you’ll remain at 6-10 dynos until the evening. To do that, just create another scale range at a later time, say 10:30 UTC, and you’ll be good to go.

Temporary scale overrides

Not every spike is on a schedule. Sometimes you need more capacity right now, for a little while: you’re about to kick off an expensive operation, or you’re deploying while running only a couple of dynos and want a higher minimum until the new release settles. For those, override the process’s scale for a set time instead of changing its scale range or schedule.

Override the scale

Click “Override Scale” on the process’s scale range or schedule. Set the scale you want, and how long the override lasts, in minutes or hours, up to a day. Processes that scale only on a schedule take a single scale instead of a range.

Scale Override modal

The override applies right away. Raising the minimum scales the process up immediately, and autoscaling keeps working within the overridden range. An override can also exceed your plan’s limits, so you can scale up for a short burst without changing your plan.

While a process is overridden, a callout above its scale range or schedule shows the overridden scale and when it ends. The scale range can’t be changed until the override ends or is removed.

Scale range with an active override

On a schedule, the calendar shows the override as a striped band with an “Override” tag, and schedule entries wait until it ends.

Schedule with an active override

To change the scale or the end time, click “Edit Override”, or the tag on the calendar. Overriding again updates the active override.

You can also override a process’s scale with the Team API, to scale up from your own jobs and deploy scripts.

When the override ends

The override ends on its own within a minute of its end time. To end it sooner, click “Edit Override” → “Remove Override”.

The process then goes back to its scale from before the override. On a schedule, it goes to the scale that’s current at that time, so an entry that started during the override still applies. As with a scheduled scale range, a lower minimum doesn’t force a downscale: autoscaling scales the process back down as traffic subsides.

Monthly or one-time events

Schedules are weekly, so they’re best for daily or weekly patterns. If you have a predictable event that happens on a specific date, such as a large monthly batch on the 1st, we don’t recommend adding a temporary weekly schedule entry and remembering to remove it later.

For that kind of event, temporarily override the process’s scale from your own scheduled job with the Team API. The override holds even when a scheduled scale range takes effect in the meantime.

This is also a good fit for a worker process that normally stays at zero. Keep autoscaling enabled with a 0–0 scale range, and override it for the batch window.