Skip to content

Smart Scaling

dockmesh scales individual services within a stack horizontally — spinning up or tearing down replicas of the same container. Scaling works on a single host; for spreading replicas across a fleet, combine with Migration.

On a stack’s detail page, each service has a Replicas input. Enter a target count and click Apply — dockmesh runs compose up --scale <service>=<n> under the hood and streams the progress.

Open a service’s Scaling tab and define a rule:

FieldExampleNotes
MetricCPU % or Memory %Per-container average
Scale-up threshold80Breached for window duration triggers scale-up
Scale-down threshold30Below for window duration triggers scale-down
Window5mHow long the threshold must hold
Min replicas2Never scale below this
Max replicas10Never scale above this
Cooldown3mTime to wait after a scaling event before the next one

Rules are evaluated by the server every 30s using the metrics pipeline. Events are logged to the audit log.

Before scaling, dockmesh runs pre-flight checks and refuses if:

  • The service has a container_name: set (Docker refuses to create a second container with the same name)
  • The service has static host port bindings ("8080:80") that would conflict with additional replicas — you need an ephemeral port or a reverse proxy
  • The service declares a bind-mounted volume that is not shared-safe (e.g. SQLite DB) — stateful services should not be scaled horizontally

The UI shows each check with a pass/fail indicator and a remediation hint.

The scaling tab shows a live chart of replica count over time, overlaid with the driving metric. You can see exactly when a scale-up fired and how the metric responded.

  • Alerts — alert on replica count stuck at max
  • Stacks — editing the underlying compose.yaml