Skip to main content

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

  1. Open your application in the Appliku dashboard
  2. Go to the Processes tab
  3. Find the process you want to scale (e.g., web, worker)
  4. Click Change Scale
  5. Set the desired number of replicas
  6. 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:

ProcessTypical ScalePurpose
web2--5+Handle HTTP traffic
worker1--10+Background task processing
scheduler1Celery Beat or cron-like scheduler (usually only 1)
note

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:

  1. Docker Swarm detects the node is unreachable
  2. Swarm reschedules all replicas from the failed node onto remaining healthy nodes
  3. The desired replica count is maintained automatically
  4. 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:

  1. Add a new server to Appliku
  2. Join it to your cluster as a worker node from the cluster settings
  3. 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