> ## Documentation Index
> Fetch the complete documentation index at: https://getfloo.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Scaling and availability

> Choose an on-demand, warm, fixed, or paused runtime mode in floo.app.toml.

Two controls in `floo.app.toml` set how quickly an app responds after a quiet
period and how much idle capacity stays running.

* Web and API services use `min_instances` and `max_instances`.
* Workers use the fixed `instances` count.
* Whether CPU is always allocated or request-based follows the service type. The *size* of the shape is set with `cpu` and `memory`; see [CPU and memory values](https://getfloo.com/docs/reference/config-spec.md#cpu-and-memory-values).

## On-demand HTTP

On-demand has the lowest idle cost; the first request after a quiet period pays
for it. The service scales from zero to its maximum.

```toml theme={null}
[services.web]
type = "web"
path = "."
port = 3000
min_instances = 0
max_instances = 3
```

The first request after scale-to-zero may cold-start the container.

### How floo keeps on-demand apps responsive

floo does two things to keep cold starts away from the people using your app,
with no configuration:

* **Keep-warm.** floo sends every web and API service in dev and prod a request
  every five minutes, so it does not scale to zero between visits. Previews and
  stopped apps are skipped; a preview warms when someone visits or signs in. The request is
  `GET /_next/static/__floo_warm`; Next.js and most frameworks answer it with a
  fast 404 without running app code.
* **Warm at sign-in.** When someone opens an app that uses floo sign-in and has
  to log in, floo starts the app while they sign in, so it is ready when they
  arrive.

These requests are ordinary requests to your service and are metered like any
other, about 4 cents a month per service and environment. They are best effort:
scale-out and the occasional instance replacement can still cold-start. To
reserve an instance through those, use [warm HTTP](#warm-http).

Most of a cold start is your app's own startup, not the instance starting.
[Cold starts](https://getfloo.com/docs/guides/cold-starts.md) shows where the time goes and how to cut it.

## Warm HTTP

Warm keeps one instance ready, so the baseline does not cold-start, and bills
that instance continuously while it idles.

```toml theme={null}
[services.web]
type = "web"
path = "."
port = 3000
min_instances = 1
max_instances = 3
```

This service keeps one instance ready and scales up to three. New burst
capacity may still cold-start.

To keep only prod warm, set dev and previews back to zero; each environment
bills only for what it keeps ready:

```toml theme={null}
[environments.dev.resources]
min_instances = 0

[environments.preview.resources]
min_instances = 0
```

See [Per-environment resources](https://getfloo.com/docs/guides/environments.md#per-environment-resources).

Warm does not mean CPU is always on. Web and API services use request-based
CPU, including services attached to floo-managed Postgres. A warm instance is
metered for the whole time it is ready, whether or not it is serving requests.

### Warm baseline cost

A warm instance bills idle CPU and memory for every hour it is ready, about 730
hours a month, and request traffic on top of that baseline is metered as usual.
Rates are on [getfloo.com/pricing](https://getfloo.com/pricing).

## Workers

Work that runs without an HTTP request belongs in a worker. Workers use a fixed
count and always-allocated CPU.

```toml theme={null}
[services.worker]
type = "worker"
path = "."
port = 3000
command = "bundle exec sidekiq"
instances = 1
```

A worker receives no HTTP traffic, and `floo deploy --preflight` and deploys accept a
worker without `port`. `floo dev` requires `port` on every service, so declare
one if you run the worker locally.

Pause a worker with `instances = 0`:

```toml theme={null}
[services.worker]
type = "worker"
path = "."
port = 3000
command = "bundle exec sidekiq"
instances = 0
```

Workers do not use `min_instances`. A global `[resources] min_instances`
applies only to web and API services.

## Defaults and limits

When HTTP `min_instances` is omitted, floo defaults to `0` on every plan and in
every environment, including production:

| Context | Default | Result |
| - | -: | - |
| Web or API, every plan and environment | `0` | On-demand |
| Worker | not applicable | Uses `instances` |

An explicit value wins, up to the platform maximums. Set `min_instances = 1` or
higher to keep an HTTP service warm; each idle instance bills continuously.
Omitted HTTP `max_instances` resolves to `3`, and omitted worker `instances` resolves to
`1`. Per-service values override delegated `floo.service.toml` values, which
override global `[resources]` values.

An HTTP service kept warm only by the old production default becomes on-demand
at its next deploy, promote, restart, or rollback, and may cold-start. floo does
not create a new revision only to migrate this default. Set `min_instances = 1`
before then to keep it warm.

## Verify the result

Inspect dev intent locally before pushing:

```bash theme={null}
floo deploy --preflight --json
```

`data.runtime_plan` separates configured values from locally resolved
defaults. An omitted HTTP minimum resolves to `0` with source `platform_default`
in every environment, with no note. Inspect production intent locally too:

```bash theme={null}
floo deploy --preflight --env prod --json
```

For an authenticated existing app, `data.plan.runtime_services` also reports
effective values and their sources after applying platform maximums.

After deploy, inspect the applied plan for an environment:

```bash theme={null}
floo services show web --app my-app --env dev --json
floo services show web --app my-app --env prod --json
```

The `runtime_plan` object keeps declared and effective values separate. It also
reports the value source, availability mode, CPU allocation mode and reason,
and warnings. A value clamped to a platform maximum, such as 4 CPU or 16Gi of memory,
reports source `plan_limit` with a warning. The maximums are the same on every
plan. A `null` source means the field does not apply to that
service type, such as worker `instances` on a web service.

> [card] [Config file spec](https://getfloo.com/docs/reference/config-spec.md)
>
> See every resource field and precedence rule.

> [card] [Preflight](https://getfloo.com/docs/cli/deploy.md#preflight)
>
> Inspect the local runtime plan before you push.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.