All Products
Search
Document Center

Serverless App Engine:DescribeApplicationScalingRules

Last Updated:Sep 26, 2023

Queries the auto scaling policies of an application.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only common request headers and does not have operation-specific request headers. For more information, see Common request and response headers.

Request syntax

GET /pop/v1/sam/scale/applicationScalingRules HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

AppId String Query Yes 7171a6ca-d1cd-4928-8642-7d5cfe69****

The application ID.

Response parameters

Parameter

Type

Example

Description

RequestId String 91F93257-7A4A-4BD3-9A7E-2F6EAE6D****

The request ID.

TraceId String 0a98a02315955564772843261e****

The trace ID that is used to query the details of the request.

Data Object

The returned result.

CurrentPage Integer 1

The page number.

TotalSize Integer 3

The total number of auto scaling policies.

PageSize Integer 10

The number of entries per page.

ApplicationScalingRules Array of ApplicationScalingRule

The auto scaling policies of the application.

Timer Object

The details of the scheduled auto scaling policy.

EndDate String 2021-04-25

The end date of the validity period of the scheduled auto scaling policy. Valid values:

  • If the BeginDate and EndDate parameters are set to null, the auto scaling policy is a long-term policy. Default value of BeginDate or EndDate: null.
  • If the two parameters are set to specific dates, the scheduled auto scaling policy can be triggered during the period between the two dates. For example, if BeginDate is set to 2021-03-25 and EndDate is set to 2021-04-25, the auto scaling policy is valid for one month.
BeginDate String 2021-03-25

The start date of the validity period of the scheduled auto scaling policy. Valid values:

  • If the BeginDate and EndDate parameters are set to null, the auto scaling policy is a long-term policy. Default value of BeginDate or EndDate: null.
  • If the two parameters are set to specific dates, the scheduled auto scaling policy can be triggered during the period between the two dates. For example, if BeginDate is set to 2021-03-25 and EndDate is set to 2021-04-25, the auto scaling policy is valid for one month.
Schedules Array of Schedule

The points in time at which the auto scaling policy is triggered within one day.

AtTime String 08:00

The point in time. Format: Hour:Minute.

TargetReplicas Integer 3

The expected number of instances.

MaxReplicas Long 50

The maximum number of instances.

MinReplicas Long 1

The minimum number of instances.

Period String * * *

The frequency at which the scheduled auto scaling policy is executed. Valid values:

  • * * *: The scheduled auto scaling policy is executed at a specified point in time every day.
  • * * Fri,Mon: The scheduled auto scaling policy is executed at a specified point in time on one or more specified days of each week. The time is in the UTC+8 time zone. Valid values:
    • Sun: Sunday
    • Mon: Monday
    • Tue: Tuesday
    • Wed: Wednesday
    • Thu: Thursday
    • Fri: Friday
    • Sat: Saturday
  • 1,2,3,28,31 * *: The scheduled auto scaling policy is executed at a specified point in time on one or more dates of each month. Valid values: 1 to 31. If a month does not have the 31st day, the auto scaling policy is executed on the specified days other than the 31st day.
UpdateTime Long 1616642248938

The time when the auto scaling policy was updated. Unit: milliseconds.

AppId String 7171a6ca-d1cd-4928-8642-7d5cfe69****

The application ID.

CreateTime Long 1616642248938

The time when the auto scaling policy was created. Unit: milliseconds.

LastDisableTime Long 1641882854484

The time when the auto scaling policy was last disabled.

ScaleRuleEnabled Boolean true

Indicates whether the auto scaling policy is enabled. Valid values:

  • true: The auto scaling policy is enabled.
  • false: The auto scaling policy is disabled.
ScaleRuleType String timing

The type of the auto scaling policy. Valid values:

  • timing: a scheduled auto scaling policy
  • metric: a metric-based auto scaling policy
  • mix: a hybrid auto scaling policy
Metric Object

The details of the metric-based auto scaling policy.

Metrics Array of Metric

The metrics that are used to trigger the auto scaling policy.

MetricTargetAverageUtilization Integer 20

The limit on the metric.

  • The limit on the CPU utilization. Unit: percentage.
  • The limit on the memory usage. Unit: percentage.
  • The limit on the queries per second (QPS). Unit: seconds.
  • The limit on the response time. Unit: milliseconds.
  • The limit on the average number of active TCP connections per second. Unit: connections per second.
  • The limit on the QPS of the Internet-facing Server Load Balancer (SLB) instance. Unit: seconds.
  • The limit on the response time of the Internet-facing SLB instance. Unit: milliseconds.
  • The limit on the QPS of the internal-facing SLB instance. Unit: seconds.
  • The limit on the response time of the internal-facing SLB instance. Unit: milliseconds.
MetricType String CPU

The metric that is used to trigger the auto scaling policy. Valid values:

  • CPU: the CPU utilization.
  • MEMORY: the memory usage.
  • QPS: the average QPS of a Java application instance per minute.
  • RT: the average response time of all API operations in the Java application per minute.
  • tcpActiveConn: the average number of active TCP connections of an application instance within 30 seconds.
  • SLB_QPS: the average QPS of the Internet-facing SLB instance associated with an application instance within 15 seconds.
  • SLB_RT: the average response time of the Internet-facing SLB instance within 15 seconds.
  • INTRANET_SLB_QPS: the average QPS of the internal-facing SLB instance associated with an application instance within 15 seconds.
  • INTRANET_SLB_RT: the average response time of the internal-facing SLB instance within 15 seconds.
SlbProject String test

The project that stores the SLB access logs.

SlbLogstore String test

The Logstore that stores the SLB access logs.

Vport String 80

The port number of the SLB instance.

SlbId String lb-xxx

The ID of the SLB instance.

MetricsStatus Object

The execution status of the metric-based auto scaling policy.

DesiredReplicas Long 2

The expected number of instances.

NextScaleTimePeriod Integer 3

The duration for which the metric-based auto scaling policy takes effect next time.

CurrentReplicas Long 2

The current number of instances.

LastScaleTime String 2022-01-11T08:14:32Z

The time when the auto scaling policy was last triggered.

CurrentMetrics Array of CurrentMetric

The metrics that are used to trigger the auto scaling policy this time.

Type String Resource

The type of the data. This parameter corresponds to the metric.

  • Resource: used when the metric is the CPU utilization or memory usage.
  • Pods: used when the metric is the number of active TCP connections.
  • External: used when the metric is about the SLB instance or from Application Real-Time Monitoring Service (ARMS).
CurrentValue Long 0

The current value of the metric.

Name String cpu

The name of the metric.

  • cpu: the CPU utilization.
  • memory: the memory usage.
  • arms_incall_qps_v2: the QPS of the Java application.
  • arms_incall_rt: the response time of the Java application.
  • tcpActiveConn: the number of active TCP connections.
  • slb_incall_qps: the QPS of the Internet-facing SLB instance.
  • slb_incall_rt: the response time of the Internet-facing SLB instance.
  • intranet_slb_incall_qps: the QPS of the internal-facing SLB instance.
  • intranet_slb_incall_rt: the response time of the internal-facing SLB instance.
NextScaleMetrics Array of NextScaleMetric

The metrics that are used to trigger the auto scaling policy next time.

NextScaleOutAverageUtilization Integer 21

The metric value as a percentage that triggers the application scale-out next time.

NextScaleInAverageUtilization Integer 10

The metric value as a percentage that triggers the application scale-in next time.

Name String cpu

The name of the metric.

  • cpu: the CPU utilization.
  • memory: the memory usage.
  • arms_incall_qps_v2: the QPS of the Java application.
  • arms_incall_rt: the response time of the Java application.
  • tcpActiveConn: the number of active TCP connections.
  • slb_incall_qps: the QPS of the Internet-facing SLB instance.
  • slb_incall_rt: the response time of the Internet-facing SLB instance.
  • intranet_slb_incall_qps: the QPS of the internal-facing SLB instance.
  • intranet_slb_incall_rt: the response time of the internal-facing SLB instance.
MaxReplicas Long 3

The maximum number of instances.

MinReplicas Long 1

The minimum number of instances.

MaxReplicas Integer 3

The maximum number of instances.

MinReplicas Integer 1

The minimum number of instances.

ScaleUpRules Object

The scale-out rule.

Step Long 100

The step size for the scale-out. This parameter indicates the maximum number of instances that can be added per unit time.

StabilizationWindowSeconds Long 300

The cooldown time of the scale-out. Valid values: 0 to 3600. Unit: seconds. Default value: 0.

Disabled Boolean false

Indicates whether the application scale-in is disabled. Valid values:

  • true: The application scale-in is disabled.
  • false: The application scale-in is enabled.
Note If this parameter is set to true, the application instances are never reduced. This prevents business risks during peak hours. By default, this parameter is set to false.
ScaleDownRules Object

The scale-in rule.

Step Long 100

The step size for the scale-in. This parameter indicates the maximum number of instances that can be removed per unit time.

StabilizationWindowSeconds Long 300

The cooldown time of the scale-in. Valid values: 0 to 3600. Unit: seconds. Default value: 0.

Disabled Boolean false

Indicates whether the application scale-in is disabled. Valid values:

  • true: The application scale-in is disabled.
  • false: The application scale-in is enabled.
Note If this parameter is set to true, the application instances are never reduced. This prevents business risks during peak hours. By default, this parameter is set to false.
ScaleRuleName String test

The name of the auto scaling policy.

MinReadyInstances Integer 1

The minimum number of available instances. Valid values:

  • 0: Business interruptions occur when the application is upgraded.
  • -1: The minimum number of available instances is automatically set to a system-recommended value. The value is the nearest integer to which the calculated result of the following formula is rounded up: Current number of instances × 25%. For example, if five instances are available, the minimum number of available instances is calculated by using the following formula: 5 × 25% = 1.25. In this case, the minimum number of available instances is 2.
Note To ensure business continuity, make sure that at least one instance is available during application deployment and rollback.
MinReadyInstanceRatio Integer -1

The ratio of the minimum number of available instances to the current number of instances. Valid values:

  • -1 (default value): The minimum number of available instances is not determined based on this parameter.
  • A number from 0 to 100: The minimum number of available instances is calculated by using the following formula: Current number of instances × (Value of MinReadyInstanceRatio × 100%). If the calculated result is not an integer, the result is rounded up to the nearest integer. For example, if five instances are available and the MinReadyInstanceRatio parameter is set to 50, the minimum number of available instances is 3.
Note If the MinReadyInstance and MinReadyInstanceRatio parameters are configured and the MinReadyInstanceRatio parameter is set to a number from 0 to 100, the value of the MinReadyInstanceRatio parameter takes precedence. For example, if the MinReadyInstances parameter is set to 5, and the MinReadyInstanceRatio parameter is set to 50, the minimum number of available instances is set to the nearest integer rounded up from the calculated result of the following formula: Current number of instances × Value of MinReadyInstanceRatio.
Message String success

The returned message. Valid values:

  • If the call is successful, success is returned.
  • If the call fails, an error code is returned.
ErrorCode String Null

The error code. Valid values:

  • If the call is successful, the ErrorCode parameter is not returned.
  • If the call fails, the ErrorCode parameter is returned. For more information, see the Error codes section in this topic.
Code String 200

The HTTP status code. Valid values:

  • 2xx: The call was successful.
  • 3xx: The call was redirected.
  • 4xx: The call failed.
  • 5xx: A server error occurred.
Success Boolean true

Indicates whether the application instances were restarted. Valid values:

  • true: The application instances were restarted.
  • false: The application instances failed to be restarted.

Examples

Sample requests

GET /pop/v1/sam/scale/applicationScalingRules?AppId=7171a6ca-d1cd-4928-8642-7d5cfe69**** HTTP/1.1
Host:sae.aliyuncs.com
Content-Type:application/json

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeApplicationScalingRulesResponse>
    <RequestId>91F93257-7A4A-4BD3-9A7E-2F6EAE6D****</RequestId>
    <TraceId>0a98a02315955564772843261e****</TraceId>
    <Data>
        <CurrentPage>1</CurrentPage>
        <TotalSize>3</TotalSize>
        <PageSize>10</PageSize>
        <ApplicationScalingRules>
            <Timer>
                <EndDate>2021-04-25</EndDate>
                <BeginDate>2021-03-25</BeginDate>
                <Schedules>
                    <AtTime>08:00</AtTime>
                    <TargetReplicas>3</TargetReplicas>
                    <MaxReplicas>50</MaxReplicas>
                    <MinReplicas>1</MinReplicas>
                </Schedules>
                <Period>* * *</Period>
            </Timer>
            <UpdateTime>1616642248938</UpdateTime>
            <AppId>7171a6ca-d1cd-4928-8642-7d5cfe69****</AppId>
            <CreateTime>1616642248938</CreateTime>
            <LastDisableTime>1641882854484</LastDisableTime>
            <ScaleRuleEnabled>true</ScaleRuleEnabled>
            <ScaleRuleType>timing</ScaleRuleType>
            <Metric>
                <Metrics>
                    <MetricTargetAverageUtilization>20</MetricTargetAverageUtilization>
                    <MetricType>CPU</MetricType>
                    <SlbProject>test</SlbProject>
                    <SlbLogstore>test</SlbLogstore>
                    <Vport>80</Vport>
                    <SlbId>lb-xxx</SlbId>
                </Metrics>
                <MetricsStatus>
                    <DesiredReplicas>2</DesiredReplicas>
                    <NextScaleTimePeriod>3</NextScaleTimePeriod>
                    <CurrentReplicas>2</CurrentReplicas>
                    <LastScaleTime>2022-01-11T08:14:32Z</LastScaleTime>
                    <CurrentMetrics>
                        <Type>Resource</Type>
                        <CurrentValue>0</CurrentValue>
                        <Name>cpu</Name>
                    </CurrentMetrics>
                    <NextScaleMetrics>
                        <NextScaleOutAverageUtilization>21</NextScaleOutAverageUtilization>
                        <NextScaleInAverageUtilization>10</NextScaleInAverageUtilization>
                        <Name>cpu</Name>
                    </NextScaleMetrics>
                    <MaxReplicas>3</MaxReplicas>
                    <MinReplicas>1</MinReplicas>
                </MetricsStatus>
                <MaxReplicas>3</MaxReplicas>
                <MinReplicas>1</MinReplicas>
                <ScaleUpRules>
                    <Step>100</Step>
                    <StabilizationWindowSeconds>300</StabilizationWindowSeconds>
                    <Disabled>false</Disabled>
                </ScaleUpRules>
                <ScaleDownRules>
                    <Step>100</Step>
                    <StabilizationWindowSeconds>300</StabilizationWindowSeconds>
                    <Disabled>false</Disabled>
                </ScaleDownRules>
            </Metric>
            <ScaleRuleName>test</ScaleRuleName>
            <MinReadyInstances>1</MinReadyInstances>
            <MinReadyInstanceRatio>-1</MinReadyInstanceRatio>
        </ApplicationScalingRules>
    </Data>
    <Message>success</Message>
    <Code>200</Code>
    <Success>true</Success>
</DescribeApplicationScalingRulesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "91F93257-7A4A-4BD3-9A7E-2F6EAE6D****",
  "TraceId" : "0a98a02315955564772843261e****",
  "Data" : {
    "CurrentPage" : 1,
    "TotalSize" : 3,
    "PageSize" : 10,
    "ApplicationScalingRules" : [ {
      "Timer" : {
        "EndDate" : "2021-04-25",
        "BeginDate" : "2021-03-25",
        "Schedules" : [ {
          "AtTime" : "08:00",
          "TargetReplicas" : 3,
          "MaxReplicas" : 50,
          "MinReplicas" : 1
        } ],
        "Period" : "* * *"
      },
      "UpdateTime" : 1616642248938,
      "AppId" : "7171a6ca-d1cd-4928-8642-7d5cfe69****",
      "CreateTime" : 1616642248938,
      "LastDisableTime" : 1641882854484,
      "ScaleRuleEnabled" : true,
      "ScaleRuleType" : "timing",
      "Metric" : {
        "Metrics" : [ {
          "MetricTargetAverageUtilization" : 20,
          "MetricType" : "CPU",
          "SlbProject" : "test",
          "SlbLogstore" : "test",
          "Vport" : "80",
          "SlbId" : "lb-xxx"
        } ],
        "MetricsStatus" : {
          "DesiredReplicas" : 2,
          "NextScaleTimePeriod" : 3,
          "CurrentReplicas" : 2,
          "LastScaleTime" : "2022-01-11T08:14:32Z",
          "CurrentMetrics" : [ {
            "Type" : "Resource",
            "CurrentValue" : 0,
            "Name" : "cpu"
          } ],
          "NextScaleMetrics" : [ {
            "NextScaleOutAverageUtilization" : 21,
            "NextScaleInAverageUtilization" : 10,
            "Name" : "cpu"
          } ],
          "MaxReplicas" : 3,
          "MinReplicas" : 1
        },
        "MaxReplicas" : 3,
        "MinReplicas" : 1,
        "ScaleUpRules" : {
          "Step" : 100,
          "StabilizationWindowSeconds" : 300,
          "Disabled" : false
        },
        "ScaleDownRules" : {
          "Step" : 100,
          "StabilizationWindowSeconds" : 300,
          "Disabled" : false
        }
      },
      "ScaleRuleName" : "test",
      "MinReadyInstances" : 1,
      "MinReadyInstanceRatio" : -1
    } ]
  },
  "Message" : "success",
  "Code" : "200",
  "Success" : true
}

Error codes

For a list of error codes, see Service error codes.