Scaling in Clusters
Docker Swarm clusters allow you to scale each process independently by setting the number of replicas. Swarm automatically distributes replicas across available worker nodes.
How Scaling Works
In standalone mode, each process is either on or off -- it runs as a single container on one server. In cluster mode, each process can have multiple replicas running simultaneously across different worker nodes.
Docker Swarm handles:
- Replica placement -- Distributes containers across worker nodes based on available resources
- Load balancing -- Routes incoming requests across all healthy replicas of a service
- Self-healing -- If a node fails or a container crashes, Swarm reschedules replicas on healthy nodes to maintain the desired count
Changing the Scale
- Open your application in the Appliku dashboard
- Go to the Processes tab
- Find the process you want to scale (e.g.,
web,worker) - Click Change Scale
- Set the desired number of replicas
- Save
The change takes effect immediately. Docker Swarm creates or removes containers to match the new replica count.
Scaling Strategies
Web Processes
Scale web processes to handle more concurrent HTTP requests. The Nginx load balancer on the leader node distributes traffic across all web replicas.
web: 1 replica --> handles baseline traffic
web: 3 replicas --> 3x request capacity
web: 5 replicas --> 5x request capacity
Worker Processes
Scale worker processes to increase task throughput for background jobs (e.g., Celery workers):
worker: 1 replica --> processes tasks sequentially
worker: 4 replicas --> 4x parallel task processing
Other Processes
Any process defined in your appliku.yml can be scaled independently. Common examples:
| Process | Typical Scale | Purpose |
|---|---|---|
web | 2--5+ | Handle HTTP traffic |
worker | 1--10+ | Background task processing |
scheduler | 1 | Celery Beat or cron-like scheduler (usually only 1) |
Some processes should only run as a single replica (scale = 1). For example, a Celery Beat scheduler should not have multiple instances, as this causes duplicate task scheduling.
Node Failure and Recovery
If a worker node goes down:
- Docker Swarm detects the node is unreachable
- Swarm reschedules all replicas from the failed node onto remaining healthy nodes
- The desired replica count is maintained automatically
- When the node recovers, Swarm may rebalance replicas across all nodes
This provides high availability without manual intervention.
Adding More Capacity
If your current worker nodes are at capacity:
- Add a new server to Appliku
- Join it to your cluster as a worker node from the cluster settings
- Docker Swarm automatically considers the new node when scheduling replicas
No application redeployment is required -- Swarm distributes new or rescheduled replicas to the new node.
Monitoring Scaled Processes
- Application logs -- View logs per process/service from Application Overview > App Logs
- Server metrics -- Monitor CPU, RAM, and disk usage on each node from the Servers page
Next Steps
- Deploying to a Cluster -- Full deployment workflow
- Cluster Limitations -- Constraints to be aware of
- Clusters Overview -- Docker Swarm architecture