You can scale an application’s resources by changing the instance size (vertical scaling) or increasing the number of instances that simultaneously run your application (horizontal scaling).
If you add persistent storage to your application’s web or background processes, those processes are limited to one instance each. There is no horizontal scaling for web or background processes with persistent storage, but you can vertically scale them by increasing the instance size for the process. You cannot add persistent storage or horizontal scaling to a cron job or job.
- Vertical scaling gives instances more power to complete resource-intensive tasks.
- Horizontal scaling improves resilience and load balancing for applications that process many requests. For example, if you run three versions of the same instance, the underlying technology routes requests to one of the three instances, effectively distributing the load between them. If one instance becomes unstable, requests will route to the other two until the third instance is healthy again.
Manual scaling
To change the instance size of a process, go to Applications > app name > Processes. Click the ellipsis > Update process.
Update the Resource to increase the resources available to a single instance (vertically scale), or update the Instance count within Scaling to add instances and improve the load balance (horizontally scale). There is a maximum of 20 instances, and all instances use the same size.
Note: If you choose the Hobby instance size for your web process, you will not be able to add a custom domain to your application. If you need a custom domain for your application, you can upgrade your web process to a larger instance size anytime.
Change resources, instance count, and horizontal autoscaling for a process.
Once you have made your changes, click Update process. The updated process costs are added to your monthly invoice and are prorated for the first month.
Automatic horizontal scaling
Horizontal auto-scaling can be enabled for a stateless web process or background worker within Processes (Sevalla > Applications > app name > Processes). When you enable horizontal auto-scaling, you’ll define a minimum and maximum number of instances you want the process to use. Note: The maximum number of instances cannot exceed 20.
When horizontal auto-scaling is enabled, if the CPU usage on the current instance(s) reaches 80% of the available CPU resources, the process automatically increases by one, up to the maximum number you’ve set.
If CPU usage drops and fewer instances are required, the system automatically scales down the number of instances to match current demand. However, it will never reduce the count below the minimum number of instances you’ve configured for horizontal auto-scaling.
While there currently isn’t a way in Sevalla to see how many instances are in use, behind the scenes, only the number of instances needed will be used. You will only be billed for the number of instances your application actually uses. For example, if the minimum instance is set to one and the maximum is set to five, but the application only uses one instance during the billing period, you will only be charged for that one instance. If the application uses more instances for part of the time during the billing period, you will only be billed for those additional instances for the time they are actually used.