Skip to main content

Sizes and resources

Available

Deployed and supported. The fields and commands described here are stable within version v1alpha1.

A service sets neither CPU nor memory: it chooses a size, from xxxs to xxxl. The size sets what is reserved for it; it can consume up to double at peak. The total of the services of your tenant is bounded by your plan's quota.

Prerequisites​

Steps​

1. Choose a size per service​

shop.yml
apiVersion: deploy.stackngo.io/v1alpha1
kind: App
metadata:
name: shop
spec:
services:
api:
image: registry.gitlab.com/acme/shop-api:1.4.2
ports: ["8080"]
size: xs # 500m / 1Gi reserved
replicas: 2
worker:
image: registry.gitlab.com/acme/shop-worker:1.4.2
size: xxxs # 100m / 200Mi: perfect for a light task
db:
image: postgres:17
user: "999"
ports: ["5432"]
size: s # 1 CPU / 2Gi
volumes:
- { path: /var/lib/postgresql/data, size: 10Gi }

Without size, a service is xxs. On the command line: sng app create … --size s, sng app patch shop --service api --size m.

2. Apply and read the state​

sng apply shop.yml
sng app describe shop

If the plan is not enough:

App : shop
Statut : QuotaExceeded
Message : db : … exceeded quota … requested: limits.memory=4Gi, used: …, limited: …
SERVICE KIND IMAGE PHASE URL DETAIL
api deployment registry.gitlab.com/acme/shop-api:1.4.2 Ready - Reconciled 2/2 prêts
db deployment postgres:17 Failed - QuotaExceeded … exceeded quota …
worker deployment registry.gitlab.com/acme/shop-worker:1.4.2 Ready - Reconciled 1/1 prêts

Reduce the size or the number of replicas, or change plans, then sng apply.

Verification​

sng app describe shop: Statut : prête. Each service has the reservation of its size and can go up to double.

Sizes​

sizeReserved CPU / memoryCPU / memory limit
xxxs100m / 200Mi200m / 400Mi
xxs (default)200m / 500Mi400m / 1000Mi
xs500m / 1Gi1 / 2Gi
s1 / 2Gi2 / 4Gi
m1 / 5Gi2 / 10Gi
l2 / 10Gi4 / 20Gi
xl4 / 24Gi8 / 48Gi
xxl10 / 48Gi20 / 96Gi
xxxl20 / 64Gi40 / 128Gi

1000m = 1 CPU. The reservation is guaranteed to the container; the limit is the ceiling beyond which it is throttled (CPU) or stopped then restarted (memory). The limit is always 2 × the reservation, for CPU as for memory.

The same values apply to the service's initialization container (init).

Your plan's quota​

Your tenant has a global quota, set by its tier: guaranteed CPU and memory (the sum of the reservations), max CPU and memory (the sum of the limits, that is double the reservations), storage and instances. Both ceilings count. Two things to remember:

  • add up the reservations of your instances and compare them to the tier's guaranteed values, then their double to the max: in 3XS (0.5 CPU / 1 Gi guaranteed, 1 CPU / 2 Gi max), two xxs services fit (400m / 1000Mi reserved, 800m / 2000Mi of limits), but not one more xxxs (1200Mi reserved);
  • the quota counts each instance: replicas: 3 in xs weighs 3 × (500m / 1Gi); during a rolling update, the extra instances (maxSurge) count too; autoscale.max sets the worst case.

When a service exceeds the quota:

WhenPhase and reasonWhat you see
at service creationFailed, QuotaExceededthe message mentions exceeded quota and the resource at fault
during an update or a scale-upProgressing, QuotaExceededthe new instances do not start; the old ones keep serving

Going from a compose consumption to a size​

If your docker-compose.yml declares deploy.resources.reservations (or limits otherwise), take the smallest size whose reservation covers both CPU and memory: cpus: "0.25", memory: 256M → xs (xxs offers 200m, not enough for 250m); cpus: "1", memory: 1G → s. Beyond xxxl, take xxxl and split the service.

Going further​

  • Sizes cannot be modified or extended by the tenant; no field allows free-form values.
  • The QuotaExceeded message names the resource that blocks (requests.cpu, limits.memory…); since both ratios are 2, it is always the same size that overflows, whichever counter is named.
  • A container that exceeds its memory limit is restarted; if this repeats, move up one size rather than multiplying replicas.

See also​