Resources
Learn about compute resources
Compute
You can configure compute resources for your service like this:
If you are configuring the resources via the configuration file instead of using the dashboard, keep in mind that cpu and memory allocation need to follow the following rules:
- The value of the
memory
parameter must be exactly 2,048 times the value of the cpu parameter. - The value of the memory parameter must be within the range of 128 to 7,168 (inclusive).
Don’t forget you can use nhost run config-validate
command to verify your values are correct.
Storage
By default a container’s disk is ephemeral so data isn’t persisted across reboots. If your service needs persistent storage you can attach one or more SSD disks by adding the following configuration:
With the above configuration, two disks will be provided. The first disk named database
will have a capacity of 10 GiB and will be mounted at /var/lib/db
. The second disk named data
will have a capacity of 1 GiB and will be mounted at “/mnt/data.
It’s important to note that disks are unique to each service and cannot be shared across multiple services.
Pausing a service
To pause a service, simply set its number of replicas to 0
:
When you pause a service, it will cease running while keeping any associated disk and registry intact.