All Products
Search
Document Center

AnalyticDB:Spot instances

Last Updated:Mar 28, 2026

Run Spark jobs at approximately 30% lower cost by enabling spot instances for your job resource groups. Spot instances use idle Spark executor resources at a discounted rate — with a trade-off: they can be preempted when on-demand rises.

Prerequisites

Before you begin, ensure that you have:

  • An AnalyticDB for MySQL cluster (Enterprise Edition, Basic Edition, or Data Lakehouse Edition)

  • A job resource group, or plan to create one

How it works

When you submit a Spark job in a job resource group with spot instances enabled, AnalyticDB for MySQL attempts to acquire idle spot instance resources first.

  • If preemption succeeds — the job runs on spot instance resources and is billed at the spot rate (approximately 30% less than ACU elastic resources).

  • If preemption fails — the job falls back to ACU (AnalyticDB Compute Unit) elastic resources and is billed at the standard rate.

After spot instance resources are acquired, a 1-hour protection period begins. Resources are not preempted during this window. After the protection period ends, resources may be reclaimed — the probability increases with usage duration. The overall job failure rate due to spot preemption is 1% to 5%.

Only large and 2xlarge Spark executor specifications support spot instances. See Spark application configuration parameters for details.

Choose a spot instance strategy

Use the following table to match your workload to the right strategy.

WorkloadRecommended strategyReason
Development and testingSpot instances for all jobsLow cost; occasional failures are acceptable
Cost-sensitive batch jobsSpot instances for all jobsJobs can tolerate retries; most complete within 1 hour
Mixed workloadsSpot for short jobs; on-demand for long jobsSeparate resource groups by expected job duration
Mission-critical productionOn-demand onlyFailures directly impact business operations
Long-running jobs (>1 hour)On-demand onlyHigh preemption probability after the 1-hour protection period

Mixed workload strategies

Option 1 — Separate resource groups

Create two job resource groups: enable spot instances for the group running short jobs, and leave it disabled for the group running long or critical jobs.

Option 2 — Per-job override

Enable spot instances at the resource group level, then set spark.adb.spotInstance.disabled=true on individual jobs that must not use spot instance resources.

Limitations

  • Spot instances are available in the following regions: China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Guangzhou), China (Hong Kong), Japan (Tokyo), Singapore, US (Silicon Valley), US (Virginia), Germany (Frankfurt), and UK (London).

  • Spot instances are supported only for job resource groups.

  • Only Spark jobs can use spot instance resources.

  • Only large and 2xlarge Spark executor specifications support spot instances.

Billing

Spot instance resources cost approximately 30% less than ACU elastic resources. For pricing details, see Pricing for Enterprise Edition and Basic Edition. For Data Lakehouse Edition pricing, see Pricing for Data Lakehouse Edition.

Enable spot instances

  1. Log on to the AnalyticDB for MySQL console. In the upper-left corner of the console, select a region. In the left-side navigation pane, click Clusters. Find the cluster and click the cluster ID.

  2. In the left-side navigation pane, choose Cluster Management > Resource Management. Click the Resource Groups tab.

For an existing job resource group

  1. Find the job resource group and click Modify in the Actions column.

  2. In the Modify Resource Group panel, turn on Spot Instance.

  3. Click OK.

  4. Verify that the Spot Instance column for the resource group shows the feature as enabled.

After enabling spot instances, Spark jobs in this resource group attempt to use spot instance resources.

Create a new job resource group with spot instances

  1. Click Create Resource Group in the upper-right corner.

  2. Configure the resource group with the following parameters:

    ParameterDescription
    Resource group name2–30 characters. Can contain letters, digits, and underscores (_). Must start with a letter.
    Job typeSelect Job. Job resource groups scale compute on demand for high-throughput batch processing.
    Minimum computing resourcesSet to 0 ACUs.
    Maximum computing resourcesSet a value between 8 ACUs and 1,024 ACUs in increments of 8 ACUs. To increase the upper limit, submit a ticket.
    Spot InstanceTurn on Spot Instance.
  3. Click OK.

  4. Verify that the Spot Instance column for the new resource group shows the feature as enabled.

Disable spot instances for a specific Spark job

To prevent a single Spark job from using spot instance resources without changing the resource group configuration, set the following parameter in the CONF section of the job:

ParameterRequiredDescription
spark.adb.spotInstance.disabledNoSet to true to disable spot instance usage for this job. Default: false (spot instances enabled).

After the job completes, check the Spot Instance Resource Usage value on the job details page. A value of 0 confirms that the job did not use spot instance resources.

Monitor spot instance usage

After a Spark job completes, go to the Monitoring page of the job resource group to view spot instance resource usage.

Disable spot instances

  1. Log on to the AnalyticDB for MySQL console. In the upper-left corner of the console, select a region. In the left-side navigation pane, click Clusters. Find the cluster and click the cluster ID.

  2. In the left-side navigation pane, choose Cluster Management > Resource Management. Click the Resource Groups tab.

  3. Find the job resource group and click Modify in the Actions column.

  4. In the Modify Resource Group panel, turn off Spot Instance.

  5. Click OK.

  6. Verify that the Spot Instance column shows the feature as disabled.

API reference

APIDescription
CreateDBResourceGroupCreates a resource group for AnalyticDB for MySQL Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters.
ModifyDBResourceGroupModifies a resource group for AnalyticDB for MySQL Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters.
DescribeDBResourceGroupQueries resource group information for AnalyticDB for MySQL Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters.
DescribeClusterResourceDetailQueries resource usage information for AnalyticDB for MySQL Enterprise Edition, Basic Edition, and Data Lakehouse Edition clusters.