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 docs for fly-autoscaler #1583

Merged
merged 6 commits into from
Jun 20, 2024
Merged

Add docs for fly-autoscaler #1583

merged 6 commits into from
Jun 20, 2024

Conversation

andie787
Copy link
Contributor

@andie787 andie787 commented Jun 17, 2024

Summary of changes

Add docs for fly-autoscaler, the metrics-based autoscaler app.

Preview

Related Fly.io community and GitHub links

Notes

apps/autoscale-by-metric.html.markerb Outdated Show resolved Hide resolved
apps/autoscale-by-metric.html.markerb Outdated Show resolved Hide resolved
@andie787
Copy link
Contributor Author

@benbjohnson Made some smaller fixes from the original draft but left comments for you about bigger changes.

Copy link
Contributor

@benbjohnson benbjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All your suggestions look good to me. 👍

@andie787 andie787 changed the title WIP: docs for fly-autoscaler Add docs for fly-autoscaler Jun 19, 2024
Copy link
Contributor Author

@andie787 andie787 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benbjohnson
Final final review!

Comment on lines +193 to +194
- `FAS_CREATED_MACHINE_COUNT`: An [Expr](https://expr-lang.org/) expression to calculate the number of Machines to create or destroy.
- `FAS_STARTED_MACHINE_COUNT`: An [Expr](https://expr-lang.org/) expression to calculate the number of Machines to stop or start.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that there are still some MIN and MAX versions of FAS_CREATED_MACHINE_COUNT and FAS_STARTED_MACHINE_COUNT. Do we include these in the reference or do we just use the Expr expression to calculate these values internally?

- `FAS_PROMETHEUS_QUERY`: The Prometheus query to run.


### Temporal collector
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a FAS_TEMPORAL_QUERY variable, but it's not in the Fresh Produce or this doc? What is it and should we include it?

- `FAS_CREATED_MACHINE_COUNT`: An [Expr](https://expr-lang.org/) expression to calculate the number of Machines to create or destroy.
- `FAS_STARTED_MACHINE_COUNT`: An [Expr](https://expr-lang.org/) expression to calculate the number of Machines to stop or start.

### Prometheus collector
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a FAS_PROMETHEUS_TOKEN variable too. What is it and should we include it?


The metrics-based autoscaler scales an app's Machines based on any metric, such as pending work items or queue depth. Scaling on metrics other than requests or connections is useful for apps, like background workers, that aren't running web services. Apps with services that need to scale based on HTTP requests can use the built-in Fly Proxy [autostop/autostart feature](https://fly.io/docs/apps/autostart-stop/) for Machines.

The autoscaler works by collecting metrics from different sources, such as Prometheus or Temporal, and computing the number of required Machines based on those metrics. This reconciliation process happens on a loop every 15 seconds by default. We use the [Expr language](https://expr-lang.org/) for defining target Machine counts, which gives a rich set of built-in arithmetic functions.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we say how you can change the reconciliation interval in the yml config? Can you use a combination of yaml config and env variables?

@andie787
Copy link
Contributor Author

@benbjohnson I'm going to publish as-is, since it's fairly complete, and we can revisit my questions when there's time.

@andie787 andie787 merged commit 5a421b5 into main Jun 20, 2024
3 checks passed
@andie787 andie787 deleted the autoscaler branch June 20, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants