# Scaling

How to set the bounds your provider scales an environment between, and how to see how much of the time it was scaled to zero.


You set between how many replicas of the web container your provider may scale. The provider scales by itself within these bounds; Brewless is not involved in each decision.

```bash
brewless scale production --min=1 --max=10
```

The same bounds can be set on the page of the environment in the console, or in your `brewless.yml` under `web.min` and `web.max`, where a deploy applies them. Bounds the file sets are shown in the console as set there, and changing them in the console or with `brewless scale` is refused: change the file and deploy. The file can also give each container its memory, processor time, timeout and local disk; see [brewless.yml](/reference/brewless-yml).

| Option | What it sets |
| --- | --- |
| `--min` | The fewest replicas. `0` lets the container sleep when idle |
| `--max` | The most replicas your provider may start |

## Scaling to zero

With a minimum of `0` the container sleeps when nobody asks for it. The first request after that waits for the container to start.

> [!TIP]
> Scale to zero on staging and development environments, and keep at least one replica on production if the first visitor should not wait.

## Serverless usage

The page of an environment shows how much of a period its web container ran and how much of it was scaled to zero:

| Figure | What it means |
| --- | --- |
| Runtime | The time at least one instance was running |
| Scaled to zero | The time no instance was running |
| Scale-to-zero | Scaled to zero as a share of the whole period |
| Cold starts | How often the container went from no instance to at least one |

The period is the last 30 days unless you choose 24 hours, 7 days, 90 days or 12 months. The timeline under the figures has a bar per hour or per day; the filled part is the share of it the container ran.

These figures are about the container. How long a serverless database was up, measured the same way from Scaleway's own figures once an hour, and how the storage of every database grew, is on the [Databases](/running/databases) page.

> [!NOTE]
> Scaled to zero is not downtime. Your provider starts an instance as soon as a request comes in.

### How it is counted

Once an hour Brewless reads from Scaleway, per minute, whether the container had an instance, and keeps the totals of each hour. Several instances at the same time count as one minute of runtime.

Brewless never sends a request to your application to measure it. A health check would keep the container awake; counting from the provider's own figures does not.

Scaleway keeps its figures for about a month. The hourly totals stay at Brewless, so longer periods can be shown. Counting starts at the first hour the container was seen running, and a period that reaches further back shows what was recorded since.

## Live figures

The page of an environment also shows requests, response time and the number of replicas right now. These are read live from your providers; Brewless does not store them.
