Stateful and Stateless Horizontal Scaling for Cloud Environments
Horizontal scaling (adding several servers to the cluster) is commonly used to improve performance and provide high availability (HA). The important advantage is that it lets increase capacity on the fly and gives more freedom to grow. But at the same time, it requires the application to be carefully designed so that it is synchronized on all instances in the cloud. Jelastic tries to ease this process on maximum for admins not to waste time on reconfigurations.
Below, we’ll overview general specifics and benefits of horizontal scaling in Jelastic PaaS and go step-by-step through the process of setting the triggers for automatic horizontal scaling.
Horizontal Scaling Peculiarities
Horizontal scaling is the process of changing the number of nodes within a single layer. Herewith, the Jelastic PaaS automatically ensure the following benefits, while utilizing this feature (applicable for both automatic and manual scaling).
Selectable Scaling Mode
The preferred scaling mode for node group can be selected during a new environment creation, as well as adjusted at any moment for existing one through the topology wizard:
- Stateless – simultaneously creates all new nodes from the base image template
- Stateful – sequentially copies file system of the master container into the new nodes
The first option is comparatively faster, while the second one automatically copies all custom configurations (e.g. deployments or Custom SSL).
All newly added containers of the single layer are created at the different hardware nodes, providing advanced high-availability and failover protection.
Nodes Mass Management
Having several same-type nodes within a layer enables their synchronous management. Thus, all comprised containers can be configured simultaneously through the corresponding icons: inspected for logs and statistics, accessed via Web SSH, restarted or redeployed, etc.
Herewith, if needed a list can be expanded to operate each particular node separately.
Automatic Horizontal Scaling Based On Triggers
The implementation of automatic horizontal scaling is performed based on the nodes current resource consumption, which is monitored through the tunable triggers.
You can adjust the scaling conditions due to your needs, i.e. the lower/upper limit (percentage) for the resource consumption and a time frame the load should stay under/above it for the nodes removal/addition.
There are five different types of resources, which are monitored by triggers:
- Memory (RAM)
- Disk I/O
- Disk IOPS
The trigger starts monitoring the resource consumption immediately after addition, and when the usage level exceeds the stated limit, a trigger becomes invoked. Subsequently, if the percentage of consumed resources stays out of the specified limit for a defined period, it will be executed, adjusting the number of nodes.
To configure a trigger for the automatic horizontal scaling, follow the next steps:
1.Click the Settings button for the desired environment.
2. In the opened tab, navigate to the Monitoring > Auto Horizontal Scaling section. Here, you can see the list of all the triggers configured for the environment (if any).
Click Add to configure a new scaling condition.
3. Select the required environment layer (if multiple ones are available), switch to the tab with the resource type to be monitored, and tune the Add/Remove Nodes trigger conditions.
Click Add at the bottom to configure a new trigger.
4. In the right part of the section, you can see the graph, which shows the statistics on the chosen resource consumption.
It stores and displays information on application’s performance for the last week. You can choose an exact duration you are interested in using the drop-down list above the graph. Also, here you can enable/disable the statistics’ Auto Refresh function.
5. Hover over a particular point of the graph to see the exact amount of resource consumption for the chosen moment of time. This information can be used for setting proper conditions for triggers’ execution.
6. Each trigger has two options (i.e. Add and Remove Nodes), which can be enabled with the corresponding check-boxes right before the title.
After being turned on, each of them can be configured in a similar way using the following options:
- Whenever loading is more (less) than – the upper (lower) trigger limit in percentage (or Mbps for Network), based on which it will be invoked; also, you can state the required magnitude with the help of the appropriate sliders to the right
- For at least – the number of minutes a trigger should remain invoked before alteration of the nodes’ count; can be configured up to one hour with a 5 minutes step (i.e. 1, 5, 10, 15, etc)
- Scale out (in) to – the maximum (minimum) number of app server nodes, that can be stated within the application server layer due to automatic horizontal scaling
- Scale by – the count of nodes that are to be added/removed at a time upon trigger execution
7. As an addition, Jelastic gives you the possibility to receive email notifications on horizontal scaling events. This option is enabled by default but you can disable it using the appropriate Send Email Notifications switcher.
If enabled, you will receive an email message every time the trigger is executed with the detailed information on the Reason and Result of the automatic scaling.
8. While editing existing trigger, you can Apply the changes, Undo Changes to restore the previous trigger state or Close to exit without any changes.
9. Consequently, you can track the triggers execution through the appropriate environment Settings > Monitoring > Events History section by selecting the Horizontal Scaling type within Filters.
Hover over the particular record to get additional information within the pop-up frame.
Configure a set of horizontal scaling triggers and track their execution in order not to worry about your application performance, as well as not to overpay for unused resources. Get started for free at one of the Jelastic PaaS service providers.