All Products
Search
Document Center

ApsaraDB RDS:Overview of serverless ApsaraDB RDS for MySQL instances

Last Updated:Mar 04, 2024

Serverless refers to the ability of ApsaraDB RDS instances to automatically scale resources that are metered in seconds. A serverless ApsaraDB RDS for MySQL instance does not use fixed specifications. The computing resources of a serverless RDS instance are automatically scaled within the range that you specify based on your workloads, and the storage resources are automatically scaled based on the data volume. This prevents waste of resources and reduces database O&M costs. A serverless RDS instance supports the automatic start and stop feature. You are charged only for the storage resources that are used when your serverless RDS instance is suspended.

Prerequisites

The serverless RDS instance meets the following requirements:

  • The serverless RDS instance is created in one of the following regions: China (Hong Kong), Indonesia (Jakarta), or Singapore.

  • The serverless RDS instance runs RDS Basic Edition or RDS High-availability Edition.

  • The serverless RDS instance uses the performance level 1 (PL1) enhanced SSDs (ESSDs) storage type.

Features

Serverless RDS instances provide the same features as regular RDS instances, such as automatic primary/secondary switchover for RDS instances that run RDS High-availability Edition and automatic backup. Serverless RDS instances also support the auto scaling and automatic start and stop features. Serverless RDS instances do not support specific features, such as read-only instances and the X-Engine storage engine. For more information, see Features.

Auto scaling

Computing resources

A serverless RDS instance is billed based on RDS Capacity Units (RCUs). The performance of an RCU is equivalent to the performance of an RDS instance that provides 1 core and 2 GB of memory. A serverless RDS instance automatically adjusts the number of RCUs within the range that you specify based on your workloads.

The number of RCUs ranges from 0.5 to 32 and can be adjusted in increments of 0.5.

The following figure shows the changes in resources that are used by a regular RDS instance and a serverless RDS instance when your workloads significantly fluctuate.

资源对比

The figure provides the following information:

  • Regular RDS instance: A large number of resources are wasted during off-peak hours. As a result, resources are insufficient during peak hours, which affects the performance of the regular RDS instance.

  • Serverless RDS instance:

    • The serverless RDS instance scales resources based on your workloads to reduce O&M costs and risks.

    • The serverless RDS instance improves resource usage and reduces resource costs.

    • The serverless RDS instance can provide sufficient resources during peak hours, which ensures performance and service stability.

Storage resources

  • You can purchase a storage capacity of up to 32 TB for a serverless RDS instance. The minimum storage capacity of a serverless RDS instance is 20 GB.

  • You must specify the minimum storage capacity of a serverless RDS instance. If the available storage is insufficient, the serverless RDS instance can automatically expand the storage capacity.

  • To ensure instance stability, the storage capacity cannot be automatically reduced. You can manually reduce the storage capacity of a serverless RDS instance. The minimum storage capacity to which you can reduce your RDS instance is calculated by using the following formula: min{Data volume × 1.3, Data volume + 400 GB}. The minimum storage capacity after the storage capacity reduction must be greater than or equal to the minimum storage capacity that is supported by the instance type of the RDS instance.

Automatic start and stop

By default, the automatic start and stop feature is disabled. If your serverless RDS instance does not receive requests within specific periods of time, you can configure the automatic start and stop feature for the instance.

  • After you enable the feature, if no connections to the serverless RDS instance are established within 10 minutes, the instance is automatically suspended.

  • If a connection is established, the serverless RDS instance is automatically started.

    Note

    In most cases, approximately 6 seconds to 40 seconds are required to start the serverless RDS instance. The actual time required for the start varies based on the status of databases and tables on the instance. The serverless RDS instance is unavailable during startup.

  • You are charged only for the storage resources that are used when your serverless RDS instance is suspended.

Scenarios

  • Scenarios in which workloads fluctuate dramatically

  • Scenarios that require infrequent access to databases, such as databases in testing environments

  • Scenarios in which intermittent scheduled tasks are involved, such as teaching and student experiments

  • Scenarios that handle inconsistent and unpredictable workloads, such as IoT and edge computing

  • Scenarios that need to reduce O&M costs and improve O&M efficiency

Billing rules

Bills for a serverless RDS instance are generated on an hourly basis.

Formula: Hourly fee for a serverless RDS instance = Resource usage of a single node x Unit price x Number of nodes

Resource usage of a single node

  • Computing resources: The computing resources are billed based on RCUs. The performance of an RCU is equivalent to the performance of an RDS instance that provides 1 core and 2 GB of memory. The number of RCUs can be increased or decreased to an integer multiple of 0.5. The number of RCUs that are consumed in an hour equals the average number of RCUs that are consumed per second of the hour.

  • Storage resources: You must specify the minimum storage capacity of a serverless RDS instance. If the data volume is less than the minimum storage capacity, you are charged based on the minimum storage capacity. If the available storage is insufficient, the storage capacity is automatically expanded. You are charged based on the storage capacity after the expansion.

Number of nodes

Serverless RDS instances that run RDS Basic Edition are deployed on a single node. Serverless RDS instances that run RDS High-availability Edition are deployed on two nodes.

Billing examples

For example, you create a serverless RDS instance that runs RDS Basic Edition and has a storage capacity of 20 GB and available computing resources of 0.5 to 8 RCUs in the Singapore region. In this case, you experience a peak hour on one day. A total of 8 RCUs are used during the peak hour, 1 RCU is used per hour for the rest of the day, and a total of 20 GB of storage is used on the day.

Unit price: The unit price varies based on the region. The following table describes the fee for a serverless RDS instance in the Singapore region. For more information about the fee for a serverless RDS instance in a different region, visit the ApsaraDB RDS buy page.

Billable item

Region

Unit price

RCU

Singapore

USD 0.07455 per RCU-hour

Storage

USD 0.0004 per GB-hour

Fee for a serverless RDS instance on one day

  • Fee for RCUs = (0.07455 x 8 x 1) + (0.07455 x 1 x 23) = USD 2.31105

  • Fee for storage resources = 0.0004 x 20 x 24 = USD 0.192

Fee for the serverless RDS instance on one day = USD 2.31105 + USD 0.192 = USD 2.50305

In this example, the fee for the serverless RDS instance on one day is USD 2.50305, which is significantly less than the fee for a pay-as-you-go RDS instance with fixed specifications.

What to do next

Create or release a serverless RDS instance

Create a serverless RDS instance

Prerequisites

If you use a RAM user to create a serverless RDS instance, the AliyunRDSFullAccess policy is attached to the RAM user. For more information, see Use RAM for resource authorization.

Procedure

  1. Go to the ApsaraDB RDS buy page.

  2. Set the Billing Method parameter to Serverless.

    Note

    You can view the price in the lower-right corner of the page. The price is displayed only after you configure all required parameters.

  3. Configure the Region parameter.

    We recommend that you create the RDS instance in the same region as the Elastic Compute Service (ECS) instance on which your application is deployed. If the RDS instance and the ECS instance reside in different regions, they cannot use an internal network to communicate with each other. This affects the performance of your application.

    Note
    • For more information about regions in which serverless RDS instances are supported, see Overview of serverless ApsaraDB RDS for MySQL instances.

    • After an RDS instance is created, you cannot change the region of the RDS instance. If you want to connect an ECS instance and an RDS instance over an internal network, make sure that the RDS instance and the ECS instance reside in the same region.

    • For more information about how to view the region in which an ECS instance resides, see Get ready to use ApsaraDB RDS for MySQL.

    • If your application is deployed on an on-premises server or computer, we recommend that you select a region that is near your on-premises server or computer. This way, you can use the public endpoint of the RDS instance to connect to the RDS instance from your application.

  4. Set the Database Engine parameter to MySQL and select the required major engine version.

  5. Set the Edition parameter to Basic Edition or High-availability Edition.

  6. Set the Storage Type parameter to PL1 ESSD.

    An enhanced SSD (ESSD) is an ultra-high performance disk that is designed by Alibaba Cloud based on the next-generation distributed block storage architecture. ESSDs use 25 Gigabit Ethernet and RDMA technologies to deliver up to 1 million random read/write IOPS per disk and reduce one-way latency.

    Note

    For more information about storage types of an RDS instance, see Storage types.

  7. Configure the Minimum and Maximum parameters for RDS Capacity Units (RCUs). This way, your RDS instance can be automatically scaled by measuring the usage of RCUs.

  8. Optional. Configure the Scaling Policy and Automatic Start and Restart parameters based on your business requirements.

  9. Select a zone in which the RDS instance resides.

    • No significant differences exist between the zones in the same region.

    • If the RDS instance resides in the same zone as the ECS instance on which your application is deployed, these instances can deliver optimal performance. If the RDS instance and the ECS instance reside in different zones in the same region, the performance of the RDS instance and the ECS instance is slightly lower than the performance of the RDS instance and the ECS instance that reside in the same zone.

    Note

    If Sold Out appears in the upper-right corner of a zone name, this zone does not have sufficient resources. In this case, change the zone.

  10. If you want to create an RDS instance that runs RDS High-availability Edition, you must configure the Deployment Method and Zone of Secondary Node parameters. Valid values for the Deployment Method parameter are Multi-zone Deployment and Single-zone Deployment.

  11. Drag the slider to change the storage capacity.

    Note

    The value of the Storage Capacity parameter specifies the minimum storage capacity of the serverless RDS instance.

  12. In the lower-right corner of the page, click Next: Instance Configuration.

  13. Configure the VPC and vSwitch of Primary Node parameters. We recommend that you select the same virtual private cloud (VPC) in which your ECS instance resides. If the RDS instance and the ECS instance reside in different VPCs, you cannot connect these instances over an internal network.

    Note
    • For more information about how to view the VPC in which your ECS instance resides, see Get ready to use ApsaraDB RDS for MySQL.

    • You can connect the RDS instance and the ECS instance over an internal network even if the instances use different vSwitches in the same VPC.

  14. Configure the Add to Whitelist parameter to specify whether to add the CIDR block of the selected VPC to a whitelist of the RDS instance. If you select Yes for the Add to Whitelist parameter, the ECS instances that reside in the selected VPC can access the RDS instance.

  15. Configure other custom parameters. If you do not have special business requirements, you can retain the default values of these parameters.

    Parameter

    Description

    Parameter Template

    Select a high-performance parameter template, synchronous parameter template, or default parameter template. Parameters in the template that you select are displayed on the right. For more information, see Use a parameter template.

    Time Zone

    Select a time zone for the RDS instance.

    Table Name Case Sensitivity

    By default, this parameter is set to Case-insensitive. If the names of on-premises databases are case-sensitive, we recommend that you select Case-sensitive to facilitate data migration.

    Release Protection

    Select this option to prevent the RDS instance from being accidentally deleted. For more information, see Enable or disable the release protection feature for an ApsaraDB RDS for MySQL instance.

    Resource Group

    Use the default resource group or select a custom resource group based on your business requirements. This facilitates instance management.

    Privileged Account

    If you select Configure Now, you must configure the Database Account, Password, and Confirm Password parameters. If you select Configure Later, you can create a privileged account after the RDS instance is created.

    For more information about privileged accounts, see Create a privileged account.

  16. In the lower-right corner of the page, click Next: Confirm Order.

  17. Confirm the configuration of and configure the Purchase Plan parameter. Then, read and select Terms of Service, click Pay Now, and then complete the payment.

    The Congratulations. or The service is activated message is displayed in the ApsaraDB RDS console.

  18. View the RDS instance.

    Go to the Instances page. In the top navigation bar, select the region in which your RDS instance resides. Then, find the RDS instance based on the Creation Time parameter.

    It requires 1 to 10 minutes to create a serverless RDS instance. You can refresh the page to view the new RDS instance.

What to do next

Create databases and accounts

Release a serverless RDS instance

Auto scaling

Change the scaling range of RCUs

RCUs are used to measure the performance of a serverless RDS instance. The system automatically adjusts the number of RCUs for a serverless RDS instance within the range that you specified based on your workloads. You can manually specify the scaling range of RCUs.

Usage notes

If you change the scaling range of RCUs for a serverless RDS instance, a smooth inter-instance migration may be triggered, and jitters that last for a few seconds may occur.

Procedure

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the Configuration Information section, click Modify Scaling Settings.

  3. In the RDS Capacity Units (RCUs) section of the panel that appears, configure the Minimum and Maximum parameters.

    Note

    The number of RCUs ranges from 0.5 to 32. The performance of an RCU is equivalent to that of an RDS instance that provides 1 core and 2 GB of memory.

  4. Then, click OK.

Manually expand and reduce the storage capacity

If a serverless RDS instance is in the Running state, you can manually expand or reduce the storage capacity of the instance.

  1. Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which your RDS instance resides. Then, find the RDS instance and click the instance ID.

  2. In the Usage Statistics section of the Basic Information page, click Modify to the right of Storage Capacity. In the panel that appears, click the plus or minus sign to increase or decrease the storage capacity based on your business requirements and click OK. In the dialog box that appears, click OK.

Note

You need to wait for a few minutes because data has to be copied during the process storage capacity reduction, which usually requires more time than storage capacity expansion. When the storage capacity of the serverless RDS instance is being expanded or reduced, the status of the RDS instance is Upgrading/Downgrading. After the expansion or reduction is complete, the status of the RDS instance changes to Running.

View the changes in RCUs and storage capacity

  1. Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which your RDS instance resides. Then, find the RDS instance and click the instance ID.

  2. In the left-side navigation pane, click Monitoring and Alerts.

  3. View the Database Capacity (RCUs), MySQL Storage Space Used (MB), and Disk Usage (%) metrics.

Change the scaling policy to forcefully scale the RCUs

The RCU scaling for a serverless RDS instance immediately takes effect and does not affect your workloads. In some special cases, the database system may not be able to smoothly scale the RCUs. You can specify whether to forcefully scale the RCUs by configuring the scaling policy of the serverless RDS instance.

Usage notes

The following table describes the scaling policies that are supported for a serverless RDS instance.

Scaling policy

Description

Execute Forcefully

RCUs are forcefully scaled. This helps ensure instance performance. An instance switchover may occur during the RCU scaling. Make sure that your application is configured to automatically reconnect to the serverless RDS instance. For more information about the impacts of an instance switchover, see Impacts of an instance switchover.

Do Not Execute Forcefully

RCUs are not forcefully scaled. The connections and requests to a serverless RDS instance are maintained, but the instance stability may be affected.

Procedure

  • You can configure the Scaling Policy parameter when you create a serverless RDS instance.

  • To change the scaling policy of an existing serverless RDS instance, perform the following steps:

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the Configuration Information section, click Modify Scaling Settings.

  3. Click Advanced Settings, modify the Scaling Policy parameter, and then click OK.

Start or stop a serverless RDS instance

Enable the automatic start and stop feature

New serverless RDS instance

You can enable the automatic start and stop feature when you create a serverless RDS instance.

Existing serverless RDS instance

You can perform the following steps to enable the feature:

  1. Go to the Instances page. In the top navigation bar, select the region in which the serverless RDS instance resides. Then, find the serverless RDS instance and click the ID of the instance.

  2. In the Configuration Information section, click Modify Scaling Settings.

  3. Click Advanced Settings, select Enable from the Automatic Stop and Restart drop-down list, and then click OK in the lower part of the page.

Related operations

You can call the ModifyDBInstanceSpec operation to enable the automatic start and stop feature for a serverless ApsaraDB RDS for MySQL instance. The following table describes the required parameters.

Parameter

Description

Example

DBInstanceId

The ID of the serverless instance for which you want to enable the automatic start and stop feature.

rm-****

PayType

The billing method of the serverless instance. Set the value to Serverless.

Serverless

Direction

The specification change type of the RDS instance. Set the value to Serverless.

Serverless

ServerlessConfiguration.AutoPause

Specifies whether to enable the automatic start and stop feature for the serverless RDS instance. Valid values:

  • true

  • false (default)

true

Manually start a serverless RDS instance (manual suspension unsupported)

If your serverless RDS instance is suspended, you can use the following methods to manually start the instance:

  • On the Instances page, perform the following operations:

    Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the serverless RDS instance resides. Then, find the serverless RDS instance and click More in the Actions column. Then, click Start Instance in the drop-down list that appears.

  • On the instance details page, perform the following operations:

    Log on to the ApsaraDB RDS console and go to the Instances page. In the top navigation bar, select the region in which the serverless RDS instance resides. Then, find the serverless RDS instance and click the instance ID. In the Status section of the Basic Information page, click Start Instance.

View instance start and stop records

On the Tasks page of the ApsaraDB RDS console, you can view the start and stop records of your serverless RDS instance.

Other operations

Upgrade the RDS edition from RDS Basic Edition to RDS High-availability Edition

If a serverless RDS instance runs RDS Basic Edition, you can upgrade the RDS edition to RDS High-availability Edition.

Billing rules

You are not charged for the upgrade operation. After the upgrade, you are charged based on the pricing for RDS High-availability Edition.

Procedure

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
  2. In the Configuration Information section, click Modify Scaling Settings.

  3. In the panel that appears, set the Edition parameter to High-availability Edition and click OK.

  4. In the dialog box that appears, check the information and click OK.

    Note

    During the upgrade, the serverless RDS instance is in the Upgrading/Downgrading state. After the upgrade is complete, the status of the serverless RDS instance changes to Running.

FAQ

  1. Why is the automatic start and stop feature not enabled for my serverless RDS instance? How do I view the current number of connections to a serverless RDS instance?

    • By default, the automatic start and stop feature is disabled. You must manually enable the feature.

    • After you enable the feature, you can view the number of connections to the serverless RDS instance.

      • To view the number of connections, perform the following steps: In the left-side navigation pane of the instance details page, click Monitoring and Alerts to view the Sessions metric.

      • To view the connection details, execute the SHOW PROCESSLIST statement.

    • If you apply for a public endpoint and allow all IP addresses to access your RDS instance, the RDS instance may not be automatically suspended due to malicious external scanning. We recommend that you release the public endpoint or modify the IP address whitelist.

  2. How long does the RCU scaling take and what are the trigger conditions?

    • Time consumption: RCUs can be instantly scaled. In scenarios in which cross-host migration is required, the RCU scaling may take 2 minutes to 5 minutes. If your serverless RDS instance runs RDS High-availability Edition, the secondary node can help reduce the probability of cross-host migration.

    • Trigger conditions:

      • When one of the CPU utilization and memory usage reaches the threshold, RCUs are scaled up.

      • When both the CPU utilization and memory usage are reduced to the threshold, RCUs are scaled down.

      • The threshold varies from 60% to 80%. You can adjust the threshold to ensure availability based on your business requirements.

  3. How do I select a scaling range of RCUs?

    You can use the following methods to select a scaling range of RCUs:

    • Perform a stress test to obtain the numbers of RCUs or CPU cores that are required during peak hours and off-peak hours.

    • Estimate the scaling range of RCUs based on the required number of CPU cores. The performance of an RCU is equivalent to the performance of an RDS instance that provides 1 core and 2 GB of memory.

Free trial

If your account meets the requirements for free trials, you can apply for a free trial to use serverless RDS instances free of charge.