← All Tutorials
DevOpsMar 25, 20268 min read

Scaling Your Infrastructure on Rackline

Scale vertically and horizontally with load balancing, auto-scaling rules, and multi-region deployment.

Introduction

Scaling is the difference between an application that handles 100 users and one that handles 100,000. Rackline supports both vertical scaling (bigger machines) and horizontal scaling (more machines behind a load balancer), plus auto-scaling rules that respond to traffic in real time. This tutorial covers all scaling strategies available on Rackline.

Prerequisites

  • A Rackline account with a deployed application
  • Familiarity with basic monitoring (see the Monitoring tutorial)

Step 1 — Vertical Scaling (Scale Up)

Vertical scaling means upgrading your droplet to a larger size with more CPU, RAM, and storage. Rackline performs live resizing with minimal downtime — typically under 30 seconds. This is the simplest approach when your application is single-threaded or cannot be easily distributed.

bash
# View available sizes
rackline resources sizes list

# Resize a droplet (live, minimal downtime)
rackline resources resize my-droplet \
  --size s-4vcpu-8gb

# Resize with scheduled maintenance window
rackline resources resize my-droplet \
  --size s-8vcpu-16gb \
  --schedule "2026-03-26T03:00:00Z"

Pro Tip

Vertical scaling has limits. Once you reach the largest droplet size (64 vCPUs, 256 GB RAM), you must scale horizontally. Plan for horizontal scaling from the start by keeping your application stateless.

Step 2 — Horizontal Scaling (Scale Out)

Horizontal scaling adds more instances of your application behind a load balancer. This approach provides redundancy (if one instance fails, others handle traffic) and theoretically unlimited capacity. Your application must be stateless — store sessions in Redis and files in object storage.

bash
# Create a load balancer
rackline resources create load-balancer \
  --name my-app-lb \
  --region us-east-1 \
  --algorithm round-robin \
  --health-check /health

# Add droplets to the load balancer
rackline lb add-targets my-app-lb \
  --droplets my-app-1,my-app-2,my-app-3

# Configure sticky sessions (if needed)
rackline lb configure my-app-lb \
  --sticky-sessions cookie \
  --cookie-name RACKLINE_LB \
  --cookie-ttl 3600

Step 3 — Configure Auto-Scaling Rules

Auto-scaling automatically adds or removes instances based on real-time metrics. Define scaling policies with minimum and maximum instance counts, scale-up and scale-down thresholds, and cooldown periods to prevent rapid oscillation.

bash
# Create an auto-scaling group
rackline autoscale create \
  --name my-app-asg \
  --min-instances 2 \
  --max-instances 10 \
  --image registry.rackline.net/myapp:latest \
  --size s-2vcpu-4gb \
  --load-balancer my-app-lb

# Add scale-up rule
rackline autoscale rules add my-app-asg \
  --direction up \
  --metric cpu \
  --threshold 70 \
  --duration 2m \
  --adjustment +2

# Add scale-down rule
rackline autoscale rules add my-app-asg \
  --direction down \
  --metric cpu \
  --threshold 30 \
  --duration 10m \
  --adjustment -1 \
  --cooldown 5m

Pro Tip

Set the scale-down cooldown period longer than the scale-up period. Scaling up should be aggressive (respond to traffic spikes quickly) while scaling down should be conservative (ensure the spike is truly over).

Step 4 — Multi-Region Deployment

Deploy your application across multiple geographic regions for lower latency and higher availability. Rackline supports 12 regions worldwide. Use Rackline's global load balancer to route users to the nearest region automatically using GeoDNS.

bash
# Deploy to multiple regions
rackline deploy --environment production --region us-east-1
rackline deploy --environment production --region eu-west-1
rackline deploy --environment production --region ap-southeast-1

# Create a global load balancer
rackline resources create global-lb \
  --name my-app-global \
  --routing geo \
  --regions us-east-1,eu-west-1,ap-southeast-1 \
  --health-check /health

# Point your domain to the global load balancer
rackline domains update example.com \
  --target my-app-global

Step 5 — Validate with Load Testing

Before relying on auto-scaling in production, validate your configuration with load testing. Verify that new instances spin up quickly enough to handle traffic surges and that your application performs correctly under load.

bash
# Run a load test (Rackline built-in)
rackline loadtest run \
  --url "https://example.com" \
  --users 1000 \
  --duration 5m \
  --ramp-up 1m

# View load test results
rackline loadtest results --latest

# Monitor auto-scaling during test
rackline autoscale status my-app-asg --watch

Conclusion

Your infrastructure is now configured for automatic scaling with load balancing, auto-scaling rules, and multi-region deployment. This setup ensures your application handles traffic spikes gracefully and provides low latency to users worldwide. Combine this with monitoring and CI/CD for a complete production-ready platform.