TemperStack
Intermediate8 min readUpdated Mar 18, 2026

How to configure CPU-based autoscaling on DigitalOcean

Quick Answer

DigitalOcean's CPU-based autoscaling automatically adjusts the number of droplets based on CPU usage metrics. You configure it by creating a droplet group, setting CPU thresholds (typically 70% for scaling up, 30% for scaling down), and defining minimum/maximum instance limits.

Prerequisites

  1. Active DigitalOcean account
  2. Load balancer configured in your project
  3. Droplet image or snapshot prepared for scaling
  4. Basic understanding of server monitoring and scaling concepts
1

Create a Load Balancer

Navigate to the Load Balancers section in your DigitalOcean dashboard and click Create Load Balancer. Choose your datacenter region and configure the forwarding rules (typically HTTP on port 80 and HTTPS on port 443). Add health checks with path / or your application's health endpoint. This load balancer will distribute traffic across your auto-scaled droplets.
Tip
Ensure your health check endpoint responds quickly to avoid unnecessary scaling events.
2

Prepare Your Droplet Template

Create a droplet with your application fully configured and tested. Install all necessary dependencies, configure your application to start automatically on boot, and ensure it can handle being part of a load-balanced cluster. Once configured, go to Snapshots in the dashboard, select your droplet, and click Take Snapshot. Name it descriptively like app-v1.2-template.
Tip
Test your snapshot by creating a new droplet from it to ensure everything works correctly.
3

Access Kubernetes or App Platform

In your DigitalOcean dashboard, navigate to Kubernetes or App Platform depending on your setup preference. For Kubernetes-based autoscaling, click Create Cluster. For simpler applications, choose App Platform and select Create App. Both services provide built-in autoscaling capabilities that integrate with DigitalOcean's monitoring systems.
4

Configure the Autoscaling Group

In the cluster configuration, navigate to the Node Pools section. Enable Auto-scaling and set your minimum nodes (recommended: 2), maximum nodes (based on your budget and traffic expectations), and target CPU utilization percentage (recommended: 70%). Choose your droplet size and select the snapshot you created earlier as the base image for new instances.
Tip
Start with conservative scaling limits and adjust based on your application's actual usage patterns.
5

Set CPU Thresholds and Policies

Configure the scaling policies by setting Scale Up threshold to 70% CPU utilization for 3 consecutive minutes, and Scale Down threshold to 30% CPU utilization for 5 consecutive minutes. Set the cooldown period to 300 seconds (5 minutes) to prevent rapid scaling oscillations. Enable Predictive Scaling if available to anticipate traffic patterns.
Tip
Longer cooldown periods prevent thrashing but may delay response to traffic spikes.
6

Configure Monitoring and Alerts

Navigate to Monitoring in your dashboard and create alert policies for your autoscaling group. Set up notifications for scaling events, high CPU usage, and when you're approaching your maximum instance limits. Configure alerts to be sent via email or Slack webhook by going to Settings > Notifications and adding your preferred channels.
Tip
Set up budget alerts to monitor costs as your infrastructure scales up.
7

Test the Autoscaling Configuration

Deploy your application and generate load to test the autoscaling behavior. Use tools like ab -n 10000 -c 100 http://your-load-balancer-ip/ or wrk -t12 -c400 -d30s http://your-load-balancer-ip/ to simulate traffic. Monitor the Metrics tab to watch CPU utilization and scaling events. Verify that new droplets are added to the load balancer automatically and removed when load decreases.
Tip
Test both scale-up and scale-down scenarios to ensure your application handles dynamic instances correctly.
8

Optimize and Fine-tune Settings

After initial testing, review your scaling metrics in the Insights dashboard. Adjust CPU thresholds, cooldown periods, and instance limits based on actual performance data. Consider implementing custom metrics beyond CPU if your application is memory-intensive or has specific performance indicators. Update your scaling policies seasonally or as your traffic patterns change.
Tip
Document your scaling configuration and regularly review costs versus performance benefits.

Troubleshooting

Autoscaling is not triggering despite high CPU usage
Check that your monitoring agent is installed and running on all droplets. Verify that the CPU metric is being reported correctly in the Metrics dashboard. Ensure your scaling policies have the correct thresholds and that the evaluation period isn't too long.
New droplets are created but not receiving traffic
Verify that new droplets are being automatically added to your load balancer. Check the health checks configuration - failing health checks prevent traffic routing. Ensure your application starts correctly on boot and responds to the health check endpoint within the timeout period.
Frequent scaling up and down (thrashing)
Increase the cooldown period between scaling events to at least 5-10 minutes. Widen the gap between scale-up and scale-down thresholds (e.g., 75% up, 25% down). Review your application's CPU usage patterns and consider using a longer evaluation period for scaling decisions.
Costs are higher than expected due to scaling
Set appropriate maximum limits on your node pools and enable cost monitoring alerts. Review your scaling thresholds - they might be too aggressive. Consider using smaller droplet sizes or implementing time-based scaling policies to reduce instances during low-traffic periods. Monitor your usage patterns and adjust policies accordingly.

Related Guides

More DigitalOcean Tutorials

Other Tool Tutorials

Ready to get started with DigitalOcean?

Put this tutorial into practice. Visit DigitalOcean and follow the steps above.

Visit DigitalOcean