1. Home
  2. Training Library
  3. Alibaba Cloud
  4. Courses
  5. Using Auto Scaling to Support Your Alibaba Cloud Workloads

Scaling Rules

Contents

keyboard_tab

The course is part of this learning path

Start course
Overview
Difficulty
Intermediate
Duration
49m
Students
10
Ratings
5/5
starstarstarstarstar
Description

This course explores Alibaba Auto Scaling. We'll look at the main applications of the Auto Scaling service and you'll follow along with practical demonstrations direct from the Alibaba Cloud platform to learn how to use each auto scaling service.

Learning Objectives

  • Get a basic understanding of Alibaba Auto Scaling
  • Learn about key auto scaling concepts
  • Understand the core functions of auto scaling, including scaling group,s scaling configurations, and scaling rules
  • Learn how to trigger scaling manually and how to create triggers for automatic scaling events

Intended Audience

This course is intended for anyone looking to use auto scaling to manage their Alibaba Cloud workloads, as well as anyone studying for the ACP Cloud Computing certification exam.

Prerequisites

To get the most out of this course, you should have a basic understanding of the Alibaba Cloud platform.

Transcript

Welcome back. Let's now look at creating scaling rules. So a scaling rule defines specific scaling actions, that is how many instances should be added to or removed from the scaling group. If, as a result of executing a scaling rule, the number of ECS instances in a scaling group is less than the MinSize value or greater than the MaxSize value, auto scaling automatically adjusts the number of instances to be added or removed. For example, let's say a scaling group is created with a MaxSize of three, a total capacity that's currently at two, and a scaling rule that's set to add three more instances.

In this case, auto scaling only adds one instance. Why is that? Well, the current capacity of the group is two. There's already two instances in the group. If we add one more ECS instance, we will be at the MaxSize value that's set for the group. If we try to add three instances to our existing two, the group would contain five instances, which would exceed the MaxSize value that's set for the group. As a result, when the scaling activity occurs, the auto scaling service only adds one more instance to bring us up to the group MaxSize.

Let's imagine a second scenario in which the MinSize is two, the group currently contains three instances, and we have a scaling rule that's going to be set to remove five instances. There's two problems here. Number one, there's only three instances in the group, so we cannot possibly remove five, and number two, if we removed all three of those instances, then the size of the group would be zero, which is less than the minimum size of two. So all we can do is subtract or remove a single ECS, which will bring the size of the group down from three to two, which is the minimum. You can modify, delete or query scaling rules from the scaling rules page in the console. Let's take a look at how to do that now.

We're now back in the console. Here's our scaling group. Let's take a look at the scaling group. So first, I'll click on the scaling group ID, and we can see that in accordance with the minimum size value that we set, the group now contains two ECS instances. Previously when we were looking at the console after just enabling the group, this value was still zero. It did take some time for the group to get up to the minimum size but it did that automatically while we were off looking at the slides. So now what we want to do is set up some scaling rules. So let's do that.

So I'll click on the Scaling Rules tab here and we can begin to define some rules. I'm going to create two. I'll create one rule to add instances, and one more rule to remove them. So let's create a scaling rule called scale_up_2. His job is to scale the size of the group by two instances. I won't give him a scheduled time. What I will do is I'll leave this scheduling for later when I set up scaling activities. For now, I'll just say we want to add two instances and the warmup time, before those instances go live and are considered healthy, we'll set it to 60 seconds. You can choose a longer time if your instances need more time to finish host boot configuration. And we will call this a Simple Scaling Rule. Excuse me, actually. So we should choose Simple Scaling Rule. And we'll add two instances. And we'll give the cooldown time here actually for adding, removing the instances, we'll set that to let's say two minutes, 120 seconds. So scale_up_2.

Rather than predictive target tracking or step, we use what we call a simple scaling rule. A simple scaling rule simply carries out an add or remove operation when it is triggered by a scheduled task or an event-triggered task. So whenever this rule is triggered, it will add two instances to the group, and it will wait 120 seconds before proceeding to add or remove additional instances. Okay? We've now set that up. Let's click create scaling rule again, and we'll create another simple scaling rule that will scale down. We'll call it scale_down_2, and its job is to remove two instances from the group, again with a cooldown of 120 seconds. And we'll click OK. So we've now got these two rules set up here. That's all we needed to do to set them up. If we want, we can manually execute them by clicking on execute or we can delete them or edit their configuration. If I click on edit, I can change the quantities and the name here. And that's it for this section. In the next section of the course, we'll look at manual scaling operations.

About the Author
Avatar
Alibaba Cloud
Cloud Provider
Students
277
Courses
18
Learning Paths
2

Alibaba Cloud, founded in 2009, is a global leader in cloud computing and artificial intelligence, providing services to thousands of enterprises, developers, and governments organizations in more than 200 countries and regions. Committed to the success of its customers, Alibaba Cloud provides reliable and secure cloud computing and data processing capabilities as a part of its online solutions.