logo
23.2
search
No matching documents found.
list
search
No matching documents found.
logo
Please be aware that there is newer version of documentation available for Webswing. Documentation 24.2

Auto-scaling

With cluster deployment customers often need a way to be able to scale horizontally. The auto-scaling feature allows you to configure a service in Admin Console which automatically upscales and downscales session pools.

Auto-scaling config

In Logs view you can see the output from the auto-scaling service processing.

Auto-scaling logs

Start/stop scripts

The most important parts of the configuration are the start and stop scripts. These scripts are not included in the distribution because every customer has it's own deployment and own way to start a session pool. The script should be an executable file that is available to the Admin Console server. Make sure that the script executed by Admin Console server has all necessary rights to start a session pool.

If the script has any output, it will show in the Logs section. You should also pay attention to the amount of time needed to start the session pool. It may vary from a few seconds to start a Docker container to a few minutes to start a full VM. Make sure to configure appropriate timeouts for start/stop scripts. It is recommended to exit the script process only after you are sure that the session pool is running/stopped. The auto-scaling service always waits for the script to finish (or timeout). During this time there will be no other upscaling or downscaling. The default interval of auto-scaling service processing is 30 seconds. If you wish to change this to a different value, use webswing.autoscaling.check.interval (milliseconds) system property when starting Admin Console server.

You can also configure arguments for start/stop scripts. To use an auto-generated session pool ID, use ${sessionPoolId} as argument. A stop script should always be targeted at a particular session pool, here it is also recommended to use ${sessionPoolId} as argument.

Auto-scaling algorithm

Webswing includes a default auto-scaling algorithm. You simply define the minimum of free instance slots that must be available. If this threshold is reached an upscaling script is executed. For downscaling a threshold of maximum free instance slots is used. You can also set a minimum up-down interval. This is a minimum time that should pass between a consecutive upscale -> downscale.

If you want to create your own auto-scaling algorithm, you can provide a custom implementation of org.webswing.admin.server.services.autoscaling.config.module.AutoScalingSessionPoolModule.

Auto-drain mode

When a session pool is downscaled and there still are active sessions running, it is put into an auto-drain mode. This mode is similar to drain mode. It does not allow any new instances to be created and it also does not count as free slots in auto-scaling algorithm. When the last session exits, the stop script is called for this SP. However if there is a situation when an upscale is needed, a SP in auto-drain mode is resumed to a normal mode.

Auto-drain mode

Static session pool

You can mark a session pool as static using the sessionpool.static property in webswing-sessionpool.properties. A static session pool cannot be downscaled by auto-scaling service. This is useful if you want to have one or more session pools configured to always run, probably also with a different configuration (more max instances, higher priority, etc.) than the auto-scaled ones.

Static session pool