Tunable Triggers for Automatic Horizontal Scaling
Tunable Triggers for Automatic Horizontal Scaling
Join the DZone community and get the full member experience.Join For Free
See why enterprise app developers love Cloud Foundry. Download the 2018 User Survey for a snapshot of Cloud Foundry users’ deployments and productivity.
In our recent publication, we shared our outstanding new Jelastic Multi Nodes feature, which allows you to manually scale all the middleware stacks in your environment, providing numerous possibilities for increasing your application’s performance and reliability.
Today we’d like to pay special attention to the application server scaling as it can be performed automatically based on resource consumption. The key role of an app server is to handle the incoming requests, therefore, it’s important to increase and decrease the amount of its instances during the time when the load is changing.
The adjustment of the app servers’ number is achieved by means of configuring a set of triggers. They track the changes in the incoming load in real time and change the number of nodes within the prescribed limits. An added bonus, these triggers consider the duration of a particular load level, therefore the momentary load peak won’t initiate their execution.Nevertheless, if you want to take full control over your app configurations manually, you can set up the advanced monitoring of its resource demands using automatic notification alerts. In this case, you’ll receive an email notification each time when the cloudlets consumption level exceeds the stated limits. Based on these alerts, you can decide if it is necessary to change the amount of allocated resources and perform this yourself through the topology wizard.
And now let’s find out how to easily automate the horizontal scaling operations for your application servers and receive a truly flexible and “unassisted” hosting with Jelastic PaaS.
Triggers for Automatic Scaling
Triggers are used for defining how many application server nodes and under what conditions these should be added or removed. There are two types of triggers depending on the usage of:
In order to tune them, you simply need to state the limit for resource usage in percentages and the time period it should stay under/above this limit. After enabling, the trigger starts to monitor the amount of resources the application consumes.
If the usage level exceeds the stated percentage, trigger is invoked. The trigger will be executed if the amount of consumed resources stays the same for a stated period of time. In this case, the number of server nodes will go up or down.
- Each newly added node has the same cloudlet limits as the existing one.
- All app server instances are created at different hardware nodes, ensuring the improved reliability and high-availability.
- NGINX-balancer server is added to the environment automatically with the default minimum cloudlet limits when the number of nodes becomes more than one. When the nodes are removed (leaving just one) the balancer will remain in the environment with all configurations.
To configure a set of triggers 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.
3. Choose one of the tabs for CPU or Memory (RAM).
Click the Turned ON switcher in order to enable the trigger and set it as required.
4. In the opened tab you can see the graph which shows the statistics on the resource consumption level of your environment.
It contains the information on the application’s performance during the last week. You can choose what time period to display using the drop-down list above the graph. Here, you can also enable the statistics auto-refreshing function.
Hover above a particular point on the graph to see an exact amount of resource usage for that time. You can use this information while setting the conditions for triggers.
5. Trigger consists of two options:
- Add Nodes
- Remove Nodes
Let’s see how to configure both of them.
- Resource usage limits (in percentages)
Firstly, you need to state the percentage levels of resource usage based on which trigger will be invoked. This can be done with the help of a slider.
The upper level defines the resource limit which should be exceeded to invoke the Add Nodes trigger. To disable this option, state the value to 100%.
The lower level indicates the limit for invoking Remove Nodes trigger when the resource usage is below the stated value. To disable it specify 0% there.
- Time period (minutes)
For the trigger to be executed, the resource usage should be below/above the stated limits (%) during a specified period of time. This time period must be set in the For at least field in minutes.
- Nodes scaling (number of nodes)
By stating the value in the Scale up/down to field, you can configurethe maximum amount of nodes that can be removed/added in the environment.
At the same time, you can set how many nodes should be removed/added at once when trigger is executed using the nodes by field.
7. You can also get email notifications for horizontal scaling events. This option is enabled by default (you can disable it using the Send Email Notifications switcher).
You will receive a corresponding notification every time any of your triggers are executed, with the information on current cloudlets consumption level and number of nodes added/removed.
8. Click Apply in order to save your trigger configurations.
Triggers Execution History
You can also view the history of triggers execution for a particular environment.
1. Navigate to the Monitoring > Logs section and choose the Horizontal Scaling type within the drop-down list.
2. Define the period of time required to be displayed using the Period drop-down list. You can also choose the custom.. value here and specify the required dates manually.
3. You’ll see the list of trigger executions during the stated period with the following information:
- Date and time when a trigger has been executed
- Action performed (adding or removing nodes)
- Node Type trigger has been applied to
- Condition of trigger execution you’ve specified (%)
- Result of execution (success or failure)
4. Click on the particular event to open the Details panel at the right.
It contains some additional information:
- Loading Value - level of resource usage (CPU or Memory) at the time of trigger execution
- Node Count - the number of app servers in the environment after a particular trigger’s execution
In this way, you can configure a set of triggers without worrying about your app’s performance. Register now and enjoy the convenience of Jelastic Cloud, the most user-dedicated hosting platform!
Published at DZone with permission of Tetiana Markova , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.