# Scaling

> Set replicas, turn on autoscaling, and let idle services sleep to zero.

Source: https://gheima.ma/docs/scaling

Scale a service by hand with replicas, automatically with autoscaling, or all the way down to zero when it’s idle.

### Replicas & resources

In the service's Settings, the Resources card sets the replica count and what each replica gets. Changes apply on the next deploy.

- `Replicas`: How many copies run, from 1 to 10 (your plan caps the maximum).
- `Memory (MB)`: Memory per replica, in steps of 128 MB. Your plan sets the maximum.
- `CPU (vCPU)`: CPU per replica, in steps of 0.1 vCPU. Your plan sets the maximum.

### Autoscaling

On Pro and higher, turn on autoscaling to add and remove replicas based on CPU load. Set the minimum and maximum replicas and a CPU target from 10 to 95%. Gheima then adds or removes replicas within those bounds to hold the target.

### Scale to zero (sleep)

Set "Sleep after (minutes idle)" to scale a service to zero when it gets no traffic. It wakes on the next request. Set it to 0 to turn sleep off. On the Free plan, new web services sleep after 30 minutes idle by default.

> Note: Sleep suits staging and low-traffic services. A sleeping service runs no replicas, so it uses no CPU or memory.

### Pause & resume

To stop a service entirely, click "Pause" in the Danger zone. It stops every replica. Resume the service to bring it back with its previous replica count.

### Limits at a glance

- `Memory`: 128 to 8192 MB per replica, up to your plan's limit.
- `CPU`: 0.1 to 8 vCPU per replica, up to your plan's limit.
- `Replicas`: 1 to 10, capped by your plan.
- `CPU target`: 10 to 95% for autoscaling.
- `Sleep after`: 0 to 1440 minutes (0 turns sleep off).

> Note: Autoscaling reacts to CPU load only. Memory and CPU per replica stay fixed at the values you set.

> Result: Your service runs at the capacity you chose: fixed replicas, CPU-driven autoscaling, or zero while idle.

---

All docs: https://gheima.ma/docs.md
