DeployingScaling

Scaling

Use lizard scale to add service replicas, raise CPU or memory, or grow addon storage. To scale a service to zero, let it sleep when idle or pause it.

Scale a service

lizard scale --service api --replicas 3
lizard scale --service api --cpu 2 --memory 2048
FlagApplies toAllowed values
--replicas <n>apps1 up to your plan’s limit: 1 during the trial, 5 on Pro and Enterprise
--cpu <cores>apps and addonswhole cores: 1, 2, 3, 4
--memory <mb>apps and addons128 to 8192 MB (1 MB steps)
--storage <mb>addons only, grow-only512, 1024, 2048, 4096, 8192, 16384

You can combine flags in a single command. Replica changes roll out without a rebuild. CPU and memory changes restart the service with the new limits.

Horizontal scaling

Run multiple replicas of an app behind the load balancer:

lizard scale --service api --replicas 5

Each replica is its own pod. Make sure your app is stateless (store state in Managed Postgres, Managed Redis, or Managed Object Storage) so replicas are interchangeable.

Vertical scaling

Give a single replica more resources:

lizard scale --service api --cpu 4 --memory 8192

Growing addon storage

You can grow addon data volumes, but you cannot shrink them:

lizard scale --service postgres --storage 8192

Sleep when idle

lizard sleep --on lets a web service sleep when it gets no traffic and wake on the next request in about a second. By default it sleeps after 10 minutes without traffic; set 5 to 1440 minutes with --idle. Turning it on restarts the service once. It works only for a service with a port and one replica, so not for workers. Managed Postgres and Managed Redis can sleep too.

lizard sleep --on --idle 30 --service api
lizard sleep --off --service api    # always on

See lizard sleep.

Pause a service

lizard pause stops a service or database without deleting it: it scales to zero and keeps its URL, password, settings and data. lizard resume starts it again. A paused GitHub service ignores pushes until you resume it.

lizard pause api
lizard resume api

To pause every service in a project or workspace, use lizard project pause or lizard workspace pause. See lizard pause.

Verifying

lizard ps                 # replica status + URL
lizard events             # deploy history + current replicas
lizard metrics            # live CPU / memory / network / disk
lizard metrics --cost     # cost instead of metrics

A replica change creates no deploy, so lizard events doesn’t list it; check the Replicas table instead.

See also

Updated