Serverless ApsaraMQ for Kafka instances automatically scale to handle traffic fluctuations. Reserved capacity sets the baseline throughput for message production and consumption, while elastic traffic extends this baseline during peak periods. For predictable traffic patterns, scheduled elasticity policies adjust reserved capacity on a defined schedule.
Prerequisites
Before you begin, make sure that you have:
A serverless ApsaraMQ for Kafka instance in the Running state
How elasticity works
Each ApsaraMQ for Kafka cluster runs three replicas by default. Reserved capacity is distributed evenly across these replicas.
Standard Edition and Professional Edition instances automatically burst to twice the reserved capacity for message production. Basic Edition instances do not support lossless auto elasticity -- adjust reserved capacity manually to handle peak traffic.
Edition comparison
| Edition | SLA | Auto elasticity | Scheduled elasticity | Recommended for |
|---|---|---|---|---|
| Basic | 99.9% | Not supported. Uses HDDs, OSS, and preemptible ECS instances. | Not supported | Testing or stable-traffic workloads |
| Standard | 99.95% | Up to 2x reserved capacity | Supported | Production workloads |
| Professional | 99.99% | Max(1,024 MB/s, reserved capacity x 2). Three-zone disaster recovery. | Supported | Enterprise workloads that require high availability |
Size your reserved capacity
Reserved capacity is measured in MB/s and accounts for all three replicas. The sizing logic differs by edition because Basic Edition lacks auto elasticity.
Basic Edition -- reserve for peak traffic across all replicas:
| Steady-state traffic | Peak traffic | Formula | Reserved capacity |
|---|---|---|---|
| 600 MB/s | 1,200 MB/s | 1,200 x 3 replicas | 3,600 MB/s |
Standard or Professional Edition -- auto elasticity handles bursts up to 2x, so reserve for steady-state traffic:
| Steady-state traffic | Peak traffic | Formula | Reserved capacity |
|---|---|---|---|
| 600 MB/s | up to 1,200 MB/s | 600 x 3 replicas | 1,800 MB/s |
| 600 MB/s | up to 1,500 MB/s | (1,500 x 3) / 2 = 2,250, rounded up | 2,300 MB/s |
For Professional Edition instances with small reserved capacities, a floor of 1,024 MB/s applies to elastic traffic. For example, a reserved capacity of 60 MB/s yields a maximum elastic traffic of 1,024 MB/s (not 120 MB/s). A reserved capacity of 600 MB/s yields 1,200 MB/s. Traffic beyond the elastic limit is throttled.
Use the price calculator for serverless ApsaraMQ for Kafka instances to estimate costs.
Scheduled elasticity policies
When short-term peak traffic exceeds the maximum elastic traffic, a scheduled elasticity policy temporarily increases the reserved capacity for message production or consumption. The cluster scales up before the effective period begins and scales back down after it ends, so capacity is ready when the traffic spike arrives.
Scheduled elasticity policies are available for Standard Edition and Professional Edition instances only.
Before you begin
Review the following constraints before you create a policy:
Minimum 60-minute interval. Space consecutive scheduled elasticity tasks at least 60 minutes apart to prevent overlapping upgrade and downgrade operations.
Brief client disconnections during scaling. Adding or removing brokers triggers client disconnections and reconnections for load balancing. Configure retry logic on producers and consumers to resend failed messages. Overall service availability is not affected.
Missed start times. If the start time of a one-time policy has already passed, the policy does not run. Recurring policies run at the next scheduled cycle.
Manual upgrades disable lower-capacity policies. If you upgrade the instance to a reserved capacity higher than a scheduled policy's target, that policy is automatically disabled.
Create a scheduled elasticity policy
Log on to the ApsaraMQ for Kafka console. In the Resource Distribution section of the Overview page, select the region of your instance.
On the Instances page, click the instance name.
On the Instance Details page, click the Elasticity Policy tab.
In the Scheduled Elasticity Policy section, click Create Scheduled Elasticity Policy.
In the Create Scheduled Elasticity Policy panel, configure the following parameters:
Parameter Description Policy Name A name for the policy. Reserved Capacity for Message Production The message production capacity during the scheduled period, in MB/s. Reserved Capacity for Message Consumption The message consumption capacity during the scheduled period, in MB/s. Repeated Execution Rule How often the policy runs. See Execution rules. Effective Period The start and end time for the capacity change. The format depends on the execution rule. Effective or Not Whether the policy takes effect immediately after creation. Click OK.
The policy appears on the Elasticity Policy tab with its reserved capacities, effective period, and estimated upgrade time.
Execution rules
| Rule | Schedule format | Duration |
|---|---|---|
| Exactly-once Execution | yyyy-MM-dd HH:mm. Start time must be 1 hour to 7 days from now. | 30 minutes to 7 days |
| Every Day | HH:mm | 30 minutes to 12 hours |
| Every Week | Select days of the week, then specify HH:mm. | 30 minutes to 12 hours |
The interval between two consecutive scheduled elasticity tasks must be greater than 60 minutes.
Enable or disable a scheduled elasticity policy
In the Scheduled Elasticity Policy section, find the target policy and toggle the switch in the Effective or Not column.
When a policy is active, the Policy Preview section displays the projected reserved capacities over the next 1, 2, 3, or 7 days.
Delete a scheduled elasticity policy
In the Scheduled Elasticity Policy section, find the target policy and click Delete in the Actions column.