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 hosts, 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
Automatic horizontal scaling is implemented with the help of the tunable triggers, which are custom conditions for nodes addition (scale out) and removal (scale in) based on the load. Every minute Jelastic analyses the average consumption of the resources (for the number of minutes specified within the trigger) to decide if the node count adjustment is required.
- The statistic is gathered for the whole layer, so if there are three nodes, which are loaded for 20%, 50%, and 20% respectively, the calculated average value is 30%.
- The scale in and out conditions are independent, i.e. the analyzed period for the removal condition is not reset after a new node addition and vice versa. Such an approach provides a quicker detection of the sufficient average load during the specified interval.
- It’s recommended to set a significant difference between scaling out and scaling in limits to avoid often topology change.
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 from the drop-down list, choose the resource type to monitor (via one of the appropriate tabs – CPU, Memory, Network, Disk I/O, Disk IOPS), and tune the Add/Remove Nodes trigger conditions.
Click Add at the bottom to configure a new trigger.
4. The graph to the right shows the statistics on the selected resource consumption. You can choose the required period for displayed data (up to one week) using the appropriate drop-down list. Herewith, if needed, you can enable/disable the statistics’ Auto Refresh function.
Also, you can hover over the graph to see the exact amount of used resources for a particular moment. Use this information to set up proper conditions for your triggers.
5. Each trigger has two options (i.e. Add and Remove Nodes), which can be enabled with the corresponding check-boxes right before the title.
Both of them are configured similarly:
When loading is more (less) than – the upper (lower) limit in percentage for the average load (i.e. executes trigger if exceeded)
- the required value can be stated via the appropriate sliders on the graph
- the 100% value automatically disables the Add Nodes trigger, and 0% – the Remove Nodes one
- the minimum difference allowed between Add and Remove Nodes conditions is 20%
- the Mbps units can be selected for the Network trigger instead of the percentage
- we recommend setting the average loading for the Add Nodes trigger above the 50% threshold to avoid unnecessary scaling (i.e. wasted resources/funds)
- For at least – the number of minutes the average consumption is calculated for (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 nodes for the layer, that can be configured due to automatic horizontal scaling
- Scale by – the count of nodes that are to be added/removed at a time upon trigger’s execution
When configuring a trigger, we recommend taking into consideration the scaling mode of the layer. For example, you should set lower loading percent in the Add Nodes trigger for the stateful mode, as content cloning requires some time (especially for containers with a lot of data) and you can reach resources limit before a new node is created.
6. You automatically receive an email notification on the configured auto horizontal scaling trigger activity by default; however, if needed, you can disable it with the appropriate Send Email Notifications switcher.
7. While editing existing trigger, you can Apply the changes, Undo Changes to restore the previous trigger state or Close to exit without any changes.
8. 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.