All Products
Search
Document Center

ApsaraMQ for Kafka:Elasticity policies

Last Updated:May 20, 2025

This topic describes the elasticity capability and scheduled elasticity policies of serverless ApsaraMQ for Kafka instances.

Prerequisites

A serverless ApsaraMQ for Kafka instance is created and deployed. Make sure that the instance is in the Running state.

Elasticity

Serverless ApsaraMQ for Kafka Standard Edition and Professional Edition instances provide the elasticity capability to meet different traffic needs in the production environment. You can change the reserved capacity for message production and consumption for your ApsaraMQ for Kafka instance based on your business requirements.

Instance edition

Maximum elastic traffic

Example

Basic Edition

A service-level agreement (SLA) of 99.9% is provided. Compared with Standard Edition and Professional Edition instances, this edition of instances use more low-cost resources, including HDDs, Object Storage Service (OSS) resources, and preemptible Elastic Compute Service (ECS) instances. Lossless auto elasticity is not supported. To increase the computing capability of an instance, you must manually update the instance configurations. We recommend that you use this edition of instances in tests or scenarios with stable traffic.

If you require higher business stability, we recommend that you use Standard Edition or Professional Edition instances.

You can configure the Reserved Capacity for Message Production parameter for an ApsaraMQ for Kafka instance to reserve the capacity for message production. Unit: MB/s.

By default, each cluster has three replicas. The reserved capacity is evenly distributed among them.

To handle traffic peaks, the actual message production capacity of a cluster can be twice the reserved capacity for message production.

If the reserved capacity of a Professional Edition is small, the maximum elastic traffic for message production is 1,024 MB/s. The maximum elastic traffic for message production in a Professional Edition instance is calculated using the following formula: Maximum elastic traffic = Max (1,024 MB/s, Reserved capacity × 2).

Examples:

  • Basic Edition: The message production traffic in your business stabilizes at 600 MB/s, and the peak message production traffic does not exceed 1,200 MB/s. Based on the preceding reservation rules, we recommend that you reserve 3,600 MB/s for message production. The reserved capacity is calculated based on the following formula: 1,200 × 3 = 3,600. In the formula, 3 indicates three replicas.

  • Standard Edition or Professional Edition: The message production traffic in your business stabilizes at 600 MB/s, and the peak message production traffic does not exceed 1,200 MB/s. Based on the preceding reservation rules, we recommend that you reserve 1,800 MB/s for message production. The reserved capacity is calculated based on the following formula: 600 × 3 = 1,800. In the formula, 3 indicates three replicas.

  • Standard Edition or Professional Edition: The message production traffic in your business stabilizes at 600 MB/s, and the peak message production traffic reaches 1,500 MB/s. Based on the preceding reservation rules, we recommend that you reserve 2,300 MB/s for message production. The reserved capacity is calculated based on the following formula: (1,500 × 3)/2 = 2,250. In the formula, 3 indicates three replicas.

  • Professional Edition: If the reserved capacity for message production is 60 MB/s, the maximum elastic traffic for message production is 1,024 MB/s. If the actual production traffic exceeds 1,024 MB/s, message production in the instance is throttled. If the reserved capacity for message production is 600 MB/s, the maximum elastic traffic is 1,200 MB/s. If the actual production traffic exceeds 1,200 MB/s, message production in the instance is throttled.

ApsaraMQ for Kafka provides the following price calculator to help you quickly estimate fees:

Price calculator for serverless ApsaraMQ for Kafka instances

Standard Edition

An SLA of 99.95% and elastic traffic of up to twice the reserved capacity are provided, and scheduled elasticity is supported. We recommend that you use this edition of instances in the production environment.

Professional Edition

An SLA of 99.99% is provided, three-zone disaster recovery is supported, and high elastic traffic is provided for instances with small reserved capacity. We recommend that enterprises use this edition of instances.

Scheduled elasticity policies

Change object

  • A scheduled elasticity policy is used to change the reserved capacity for message production or consumption. If the peak short-term traffic exceeds the maximum elastic traffic allowed, we recommend that you configure a scheduled elasticity policy to change the reserved capacity for message production or consumption to respond to requests that have ultra-large amounts of traffic within seconds.

  • You can configure scheduled policies for Standard Edition and Professional Edition instances. For information about elastic traffic thresholds, see Elasticity.

Change impact

  • During the configuration upgrade or downgrade of an instance, clients temporarily disconnect from brokers and then reconnect to the brokers for load balancing due to the increase or decrease in the number of brokers in the cluster. This may cause a few errors. We recommend that you configure the retry mechanism on the clients to resend messages that failed to be sent during the configuration upgrade or downgrade.

  • The configuration upgrade or downgrade does not affect the overall service.

Effective period

  • To ensure the successful upgrade or downgrade of the reserved capacity to the preset capacity during the effective period, the broker runs a configuration upgrade or downgrade task before the effective period. We recommend that you configure scheduled elasticity tasks in advance to provide sufficient time for the execution of configuration upgrade or downgrade tasks.

  • The broker executes the configuration downgrade task after the effective period ends.

  • To prevent the broker from repeatedly executing configuration upgrade and downgrade tasks during the effective period, make sure that the interval between two consecutive scheduled elasticity tasks is greater than 60 minutes.

  • If the estimated execution time is earlier than the current point in time, a task that does not require repeated execution is not executed and a task that requires repeated execution is executed in the next execution cycle.

  • You can upgrade an instance to a reserved capacity that is higher than the reserved capacity specified in the enabled scheduled elasticity policy. After the upgrade is complete, all scheduled elasticity policies with a reserved capacity lower than the upgraded reserved capacity are disabled.

Add a scheduled elasticity policy

  1. Log on to the ApsaraMQ for Kafka console. In the Resource Distribution section of the Overview page, select the region where the ApsaraMQ for Kafka instance that you want to manage resides.

  2. On the Instances page, click the name of the instance that you want to manage.

  3. On the Instance Details page, click the Elasticity Policy tab.

  4. In the Scheduled Elasticity Policy section, click Create Scheduled Elasticity Policy. In the Create Scheduled Elasticity Policy panel, configure the following parameters and click OK.

    • Policy Name: Enter a policy name.

    • Reserved Capacity for Message Production: Specify the reserved capacity for message production during the scheduled period of time.

    • Reserved Capacity for Message Consumption: Specify the reserved capacity for message consumption during the scheduled period of time.

    • Repeated Execution Rule

      • Exactly-once Execution: The elasticity task is executed only once. If you select this value, specify the period of time during which the elasticity task is executed in the yyyy-MM-dd HH:mm format. The start time must range from 1 hour to 7 days from the current point in time. The interval between the start time and end time of the elasticity task must range from 30 minutes to 7 days.

      • Every Day: The elasticity task is executed every day. If you select this value, specify the time during which the elasticity task is executed in the HH:mm format. The interval between the start time and end time of the elasticity task must range from 30 minutes to 12 hours.

      • Every Week: The elasticity task is executed during a specific period of time on specific days of each week. If you select this value, select the days on which the elasticity task is executed and specify the period of time during which the elasticity task is executed in the HH:mm format. The interval between the start time and end time of the elasticity task must range from 30 minutes to 12 hours.

    • Effective Period: Specify the start time and end time of the elasticity task based on the repeated execution rule.

      Important

      To ensure the successful upgrade or downgrade of the reserved capacity to the preset capacity during the effective period, the interval between two consecutive scheduled elasticity tasks must be greater than 60 minutes.

    • Effective or Not: specifies whether the policy takes effect immediately.

    After you create a scheduled elasticity policy, you can view the details of the policy in the Elasticity Policy tab of the Instance Details page. The details include the reserved capacity for message production, reserved capacity for message consumption, effective period, and estimated upgrade time.

Start a scheduled elasticity policy

  1. In the Scheduled Elasticity Policy section, find the scheduled elasticity policy that you want to manage.

  2. In the Effective or Not column, turn on the image button.

    After the scheduled elasticity task takes effect, you can view the reserved capacities for message production and consumption in a future period (1 day, 2 days, 3 days, or 7 days) in the Policy Preview section. image

Stop or delete a scheduled elasticity policy

In the Scheduled Elasticity Policy section, find the scheduled elasticity policy that you want to manage.

  • Stop the policy: In the Effective or Not column, turn off the image button.

  • Delete the policy: In the Actions column, click Delete.