Skip to main content
[ PIER ]

Container load balancing with replicas

Scale stateless services horizontally — round-robin, weighted or sticky-cookie — and let Traefik distribute traffic across replicas, with automatic health checks and per-server placement.

Three load-balancing strategies

Round-robin (the default), weighted (assign higher weights to bigger servers) and sticky-cookie (session affinity for stateful workloads). Switch between them per service without redeploying.

Scale 1 → N from the UI

Bump the replica count and Pier launches additional containers, registers them with Traefik, and starts routing traffic. Scale down and Pier drains containers cleanly.

Multi-server replica distribution

When agents are connected, replicas spread across servers automatically. Per-replica server placement is recorded so you can see where every instance lives.

Health checks and graceful failover

Traefik health-checks each replica; failed replicas stop receiving traffic until they recover. Combined with the agent_offline alert, you get end-to-end visibility into a degraded service.

Common questions

Does load balancing work for stateful services?

Sticky-cookie session affinity covers most stateful HTTP workloads. For databases and other stateful services, Pier exposes the primary today; clustering primitives are tracked under the cluster-mode roadmap.

What happens to volumes when I scale?

Each replica gets its own writable container layer. Named volumes default to per-replica today; shared read-only mounts for multi-replica setups are an upcoming follow-up to the load-balancing PR.

Can I use Pier load balancing without Traefik?

Traefik is the bundled reverse proxy and is what wires replicas together. You can disable it and front Pier with your own L7 proxy, but in that case load balancing becomes your responsibility.

Related

Ready to deploy?

One command installs Pier on any Ubuntu or Debian VPS.

curl -fsSL https://pier.sh/install | sudo bash