DigitalOcean has launched automatic horizontal scaling for its App Platform PaaS, aiming to free developers from the burden of scaling services up or down based on CPU load all by themselves.
This capability helps ensure that your applications can seamlessly handle fluctuating demand while optimizing resource usage and minimizing costs. You can configure autoscaling using either the user interface or via appspec.
Besides simplifying the creation of scalable services on their managed platform, the new capability should also help optimize performance and cost, says DigitalOcean.
The autoscaling capability will continuously collect CPU metrics and compare the average CPU utilization across all containers against a pre-defined threshold. When CPU utilization over a given period exceeds the threshold, the current deployment is cloned to create new container instances. When CPU utilization falls under the threshold, instead, the system will automatically remove container instances. Users have the option to set the threshold and limit the maximum as well as the minimum number of container instances that are allowed to run at any given time.
Autoscaling is always available for any component with dedicated instances. To enable it, you only need to define the maximum and minimum instance count and a CPU utilization threshold. The following snippet shows how you can define those values in an appspec file:
...
services:
- autoscaling:
max_instance_count: 10
min_instance_count: 2
metrics:
cpu:
percent: 80
...
Once you have defined your appspec file, you can deploy that configuration using the DigitalOcean CLI with doctl apps update
. Alternatively, you can use DigitalOcean API and provide all required configuration parameters in a JSON payload.
If you do not want to use the autoscaling capability, you must provide an instance_count
value instead of max_instance_count
and min_instance_count
.
Appspec is a YAML-based format developers can use to configure apps running on DigitalOcean App Platform, including external resources as well as environment and configuration variables. It is also possible to configure an app using the Web-based interface and then download its appspec as a backup at a specific point in time.
App Platform is DigitalOcean platform-as-a-service (PAAS) solution that allows developers to create their deployment from a git repository or using pre-built container images, with the platform taking care of the entire application lifecycle.