Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add autostart and stop docs #688

Merged
merged 7 commits into from
Apr 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more feedback changes
  • Loading branch information
Andrea Anderson authored and Andrea Anderson committed Apr 19, 2023
commit ad42e0b32158211c08448e42ca69e164e6100c26
12 changes: 6 additions & 6 deletions apps/autostart-stop.html.md.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ order: 65

<%= partial "/docs/partials/v2_transition_banner" %>

You can decide whether you want to automatically stop, or downscale, instances of your app when they're idle and automatically restart them when they're needed. Each instance of your app is running on a Fly machine. Fly Proxy controls automatically starting and automaticaly stopping machines according to settings in your `fly.toml` file, in either the `services` or `http_service` sections:
You can decide whether you want to automatically stop, or downscale, instances of your app when they're idle and automatically restart them when they're needed. Each instance of your app is running on a Fly machine. Fly Proxy controls automatically starting and automatically stopping machines according to settings in your `fly.toml` file, in either the `services` or `http_service` sections:

```toml
...
Expand All @@ -30,7 +30,7 @@ You can decide whether you want to automatically stop, or downscale, instances o

## Default and recommended values

New V2 app created using the `fly launch` command are automatically started and automatically stopped by default:
New V2 apps created using the `fly launch` command are automatically started and automatically stopped by default:

```toml
auto_stop_machines = true
Expand All @@ -56,7 +56,7 @@ The Fly Proxy runs the process to stop and start machines automatically every fe

When `auto_stop_machines = true` in your `fly.toml`, the proxy looks at machines running in a single region and uses the [`soft_limit` setting](/docs/reference/configuration/#the-http_service-section) for each machine to determine if there's excess capacity. If the proxy decides there's excess capcity, it will stop exactly one machine. The proxy repeats this process every few minutes, stopping only one machine per region, if needed, each time.

Fly proxy considers all of the running instances of your app in a given region, such as `fra`, and determines excess capacity as follows:
Fly Proxy considers all of the running instances of your app in a given region, such as `fra`, and determines excess capacity as follows:

* If there's more than one instance in the region:
* the proxy determines how many instances are over their `soft_limit` setting and then calculates excess capacity: `excess capacity = num of instances - (num instances over soft limit + 1)`
Expand All @@ -67,17 +67,17 @@ Fly proxy considers all of the running instances of your app in a given region,

When `auto_start_machines = true` in your `fly.toml`, the Fly Proxy restarts an instance in the nearest region when required.

Fly proxy determines when to start an instance as follows:
Fly Proxy determines when to start an instance as follows:

* The proxy waits for a request to your app.
* If all running instances are above their `soft_limit` setting, then the proxy starts a stopped instance from the nearest region (if there are any stopped instances).
* The proxy routes the request to the newly started instance.

## When to Stop and Start Machines Automatically, or Not

If your app has highly variable workloads, then you can set `auto_stop_machines` and `auto_start_machines` to true to manage your instances as demand decreases and increases. This could reduce costs, because you'll never have to run excess instances to handle peak load; you'll only run what's necessary at any given time.
If your app has highly variable request workloads, then you can set `auto_stop_machines` and `auto_start_machines` to `true` to manage your instances as demand decreases and increases. This could reduce costs, because you'll never have to run excess instances to handle peak load; you'll only run and be charged for the number of machines that are needed at any given time.

The difference between this feature and what is typical in autoscaling, is that there's no specified maximum for creating new instances. It will automatically start only existing instances. For example, if you want to have a maximum of 10 instances available to service requests, then you need to create 10 instances of your app.

If you need your app to be “always on”, then you can set `auto_stop_machines` and `auto_start_machines` to false. Instances will scale down to zero if `auto_stop_machines` is true and there’s no traffic to your app.
If you need your app to be “always on”, then you can set `auto_stop_machines` and `auto_start_machines` to `false`. Instances will scale down to zero if `auto_stop_machines` is set to `true` and there’s no traffic to your app.