Resources and replicas
Cap the memory and CPU an app or a database may take, and run several copies of an app.
Limits stop one app from taking down its server. Replicas run several copies of an app, with visitors shared between them.
Set a memory and CPU limit
Open Resources
Open the app or the database, then Settings -> Resources.
Pick a size
Nano (256 MB, 0.25 CPU), Micro (512 MB, 0.5), Small (1 GB, 1), Medium (2 GB, 2) or Large (4 GB, 4). No limit is the default. Or type your own Memory limit and CPU limit.

Each field shows what the app uses now and its recent peak. Apply fills in a suggested size.
Save, then redeploy
Save in the bar at the bottom. The limits apply on the next deploy.
Over its memory limit, the app is killed and restarted
It looks like a crash, with no error in the logs. Set the limit above the app's real peak, and watch Monitoring before tightening it.
Advanced limits
| Field | What it caps |
|---|---|
| Memory reservation | RAM kept free for it when the server is busy |
| Swap limit | Memory plus swap |
| CPU shares | Its share of CPU when the server is busy. Default 1024 |
| CPU pinning | Which cores it runs on, like 0-3 |
| Process limit | Processes and threads |
| Open files | Open files. Raise it on "too many open files" |
| User processes | Processes per user |
| Shared memory | /dev/shm, 64 MB by default. Some databases and Chromium need more |
| Disk quota | Its own files, not its volumes. Works only on some servers: leave it empty unless yours supports it |
| OOM priority | Who is killed first when the server runs out of memory |
Run several replicas
Set Replicas
Open the app, then Settings -> Advanced -> Replicas, and pick 1 to 10.
Redeploy
The copies start on the next deploy, all on the app's server. A deploy briefly uses twice the memory while they start.
An app that keeps data on its own disk runs one copy. More is refused when the app has a Volume, a Bind or a published port. Keep the data in a database to run more.
An app that remembers a visitor in its own memory needs Keep each visitor on the same replica, in the same place. It shows with more than one replica.
A Compose app sets the number in its own file:
services:
web:
image: ghcr.io/acme/web:1.4.0
deploy:
replicas: 3Good to know
- On a Compose app, limits apply to each service. A limit the compose file sets wins.
- MySQL and MariaDB need about 512 MB. Less can make them restart in a loop.
- Replicas are not added under load. The number is the one you set.
Something wrong? See Deploys and builds.
Did this page help you?