Scaling
This feature is in alpha. While the feature should be stable, it may be changed or removed without prior notice. As such we do not recommend using this feature in any automated pipelines. During this time we greatly appreciate any feedback as we continue to finalize the implementation. You can reach us at support@architect.io.
Services will sometimes need to be scaled horizontally in order to handle more traffic, and Architect makes that easy through a few simple methods. Read on to find out how to quickly scale your services.
Services cannot be scaled up when using an environment running on the shared “architect” cluster; the funtionality is only available for private clusters.
Scale command
Scaling up and down
Whether or not services are already running, the scale
command can be used to
add scaling settings to an environment for a particular service of a component.
If the service is running, the scale
command will immediately scale the
service running in the environment to the number of replicas specified. This is
especially useful when the number of replicas of a service should differ between
environments.
If the react demo project was deployed to an environment called “scaling-example” following the steps in the README, all services will be started with a default replica count of 1. If for some reason the app needs to be scaled up, it can be done with the following command:
You should see a confirmation in green text that scaling was completed and that the scaling settings for the environment were updated. If you check out the page for the environment graph on the Architect Cloud you’ll notice that the number of replicas for the particular service has increased to two. Scaling back down can be accomplished with a similar command:
Clearing scaling settings
When the scale
command is run, it will configure the environment to scale the
service to the specified number of replicas for all future deployments. To clear
the environment’s scaling settings for the app
service, run the command with
the --clear
flag like so:
Note that using the --clear
flag will have no effect on the number of
currently-running replicas.
replicas
component config property
If a service of a component should have a certain number of replicas across all
environments, the replicas
field of a service config can be used. Setting the
number of replicas with the scale
command will override the number of replicas
set in the component config file.
Autoscaling
You can set scaling rules for CPU and memory for a service. This will allow them to automatically scale as needed. Below is an example of an architect.yml file with scaling rules set for max and min replicas, and the amount of memory and CPU usage for each replica: