All Products
Search
Document Center

ApsaraDB RDS:Use the data archiving feature of general ESSDs

Last Updated:Nov 14, 2024

When you store a large volume of data on an ApsaraDB RDS for MySQL instance, the storage cost increases. In most cases, business data is divided into cold data and hot data. You can archive cold data to Object Storage Service (OSS) buckets, which greatly reduces your storage costs.

Feature description

After you enable the data archiving feature of general Enterprise SSDs (ESSDs) for an RDS instance, you can execute DDL statements to convert data between ESSDs and OSS buckets. The data archiving feature allows you to store large tables that are infrequently accessed to OSS buckets and use the native InnoDB access method to read data from the tables. The following DDL statements are supported:

  1. You can execute the following statement to archive data:

    ALTER TABLE $table_name ENGINE_ATTRIBUTE='{"OSS":"Y"}';
    Note

    ApsaraDB RDS for MySQL allows you to archive all data in a table to an OSS bucket. After you archive a table, you can no longer write data to the table. You can perform the SELECT, DROP TABLE, DROP DATABASE, and RENAME operations on the table.

  2. You can execute the following statement to retrieve data:

    ALTER TABLE $table_name ENGINE_ATTRIBUTE='{"OSS":"N"}';

In ApsaraDB RDS for MySQL, archived tables retain the complete InnoDB indexes and are transactional. This allows offset queries and cache acceleration for archived tables and improves the efficiency of cold table access.

Benefits

After you enable the data archiving feature, you can store data of your RDS instance in an OSS bucket at low costs based on the mass storage, security, cost-effectiveness, and high reliability of OSS. The data archiving feature allows you to retain the InnoDB transaction capabilities and read data that is infrequently accessed. After you enable the data archiving feature, the storage cost is 80% lower the storage cost when you use ESSDs of performance level 1 (PL1).

Note

If you want to improve query performance, you can enable the I/O acceleration feature. For more information, see Use the I/O acceleration feature of general ESSDs.

Applicable scope

  • Engine: MySQL

  • Product type: standard and YiTian

  • Storage type: general ESSD

    Note
  • Version: MySQL 8.0 with a minor engine version of 20240131 or later

  • Edition: RDS Basic Edition, RDS High-availability Edition, and RDS Cluster Edition

  • Unavailable regions: South Korea (Seoul), and UK (London)

Billing rules

Free of charge during the public preview

During the public preview, which starts from June 20, 2024 to July 25, 2024, you can use the feature free of charge. After the public preview ends, you are charged based on the volume of data that is archived to the OSS bucket.

Billing

Only the pay-as-you-go billing method is supported. The following table describes the pricing of the feature for RDS instances that run different RDS editions:

Region

RDS Basic Edition

RDS High-availability Edition

RDS Cluster Edition (calculated based on the number of nodes)

China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Zhangjiakou), China (Hohhot), China (Ulanqab), China (Shenzhen), China (Heyuan), China (Guangzhou), and China (Chengdu)

USD 0.000032 per GB-hour

USD 0.000065 per GB-hour

USD 0.000032 per GB-hour

China (Hong Kong)

USD 0.000034 per GB-hour

USD 0.000068 per GB-hour

USD 0.000034 per GB-hour

Philippines (Manila) and US (Silicon Valley)

USD 0.000058 per GB-hour

USD 0.000117 per GB-hour

USD 0.000058 per GB-hour

Japan (Tokyo), Singapore, Indonesia (Jakarta), and Germany (Frankfurt)

USD 0.000034 per GB-hour

USD 0.000068 per GB-hour

USD 0.000034 per GB-hour

Malaysia (Kuala Lumpur)

USD 0.000057 per GB-hour

USD 0.000114 per GB-hour

USD 0.000057 per GB-hour

US (Virginia)

USD 0.000054 per GB-hour

USD 0.000108 per GB-hour

USD 0.000054 per GB-hour

Note

The feature is not supported in the following regions: Thailand (Bangkok), South Korea (Seoul), UK (London), and UAE (Dubai).

Limits

  • If an RDS instance uses the serverless billing method, the data archiving feature is not supported for the RDS instance.

  • Tables that are stored in an OSS bucket support the SELECT, DROP TABLE, DROP DATABASE, and RENAME operations. After you transfer the data of a table from an OSS bucket to an ESSD, the table supports all operations.

  • You cannot store partitioned tables, tables that contain full-text indexes, encrypted tables, tables that contain foreign keys, and compressed tables in an OSS bucket. Tables that use table compression and page compression are considered compressed tables.

  • Due to the access latency of OSS, the access latency of cold tables in an OSS bucket reaches 10 ms, which is higher than the access latency of ESSDs.

  • The size of an archived table in your RDS instance cannot be smaller than 6 MB.

  • DDL statements that are used to archive data are not executed by using the INSTANT algorithm. The execution duration of the DDL statements is affected by the table size, and metadata locks (MDLs) may be held during the execution.

  • The data archiving feature may affect instance backups and specific features of the RDS instance. The following table describes the affected features.

    Feature

    Description

    Single-digit second backup

    • If you want to enable the single-digit second backup feature, you must disable the data archiving feature. For more information, see Disable the data archiving feature.

    • If you want to enable the data archiving feature, you must disable the single-digit second backup feature.

    Cross-region backup

    • If you want to enable the cross-region backup feature, you must disable the data archiving feature. For more information, see Disable the data archiving feature.

    • If you want to enable the data archiving feature, you must disable the cross-region backup feature.

    Restoration of individual databases and tables

    If you want to restore a database, you can restore only data that is not archived in the database.

    Backup set download

    A downloaded backup set contains only data that is not archived.

    Note

    If you enable the data archiving feature, the speed of instance backup or restoration is decreased because the archived data needs to be restored.

Usage notes

OSS storage and reads consume memory resources. You must change the speeds and frequencies of data conversion and data access.

Enable and disable the data archiving feature

Enable the data archiving feature

You can enable the data archiving feature on the ApsaraDB RDS buy page or instance details page.

ApsaraDB RDS buy page

  1. Go to the ApsaraDB RDS buy page.

  2. Set the Storage Type parameter to General ESSD. The Configuration parameter is displayed. The Cache, Data, and Cold Storage cards are displayed for the Configuration parameter. You can enable the data archiving feature in the Cold Storage card.

    image

Instance details page

  1. Go to the Instances page. In the top navigation bar, select a region. Then, click the ID of the RDS instance that meets the requirements of the data archiving feature.

  2. On the instance details page, click Configure General ESSD. In the Data Archiving card of the dialog box that appears, turn on Data Archiving.

    image

    Important

    When you enable the data archiving feature, a transient connection that lasts for approximately 30 seconds occurs.

Disable the data archiving feature

  1. Log on to the ApsaraDB RDS console and 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. On the instance details page, click Configure General ESSD. In the Data Archiving card of the dialog box that appears, turn off Data Archiving.

    image

    Important
    • When you disable the data archiving feature, a transient connection that lasts for approximately 30 seconds occurs.

    • If you want to disable the data archiving feature, make sure that the OSS bucket does not contain archived tables. If the OSS bucket contains an archived table, you cannot disable the feature. In this case, you must convert the archived table into an online table or perform the DROP operation on the archived table and then disable the data archiving feature.

View archived data

  1. View archived data in the console.

    1. Go to the Instances page. In the top navigation bar, select a region. Then, click the ID of the RDS instance that meets the requirements of the data archiving feature.

    2. In the left-side navigation pane, click Cold Storage Management. In the Archive Layer Settings section of the page that appears, view the databases for which the data archiving feature is enabled.

  2. Execute SQL statements to view archived data.

    SELECT t.NAME AS tablespace_name, SUBSTRING_INDEX(t.NAME, '/', 1) AS database_name, SUBSTRING_INDEX(t.NAME, '/', -1) AS table_name, oss.OSS_OBJECT_NUM * oss.OSS_OBJECT_SIZE AS SIZE_IN_OSS_BYTES FROM information_schema.innodb_tables AS t JOIN information_schema.innodb_tablespaces_oss AS oss ON t.space = oss.space;

References

Parameters

The following table describes the parameters that are supported for the data archiving feature. You can modify parameter settings based on your business requirements. For more information, see Parameters supported by ApsaraDB RDS instances that run MySQL 8.0.

Parameter

Default value

Description

innodb_oss_ddl_threads

16

  • The number of concurrent threads for archived data conversion.

  • Before the upper limit of the bandwidth is reached, you can increase the parameter value to accelerate archived data conversion. However, this increases memory consumption and bandwidth consumption.

innodb_oss_files_limit

10240

  • The number of control blocks for archived data. The control blocks are cached in memory.

  • When you archive data to an OSS bucket, the tables in ESSDs are divided into data file blocks and uploaded to the OSS bucket. The tablespace and data range of each data file block are stored in the corresponding control block. Control blocks are stored in the memory. The control blocks are used to quickly identify the offset requested by the archived data and perform cache control by using the LRU algorithm.

innodb_oss_prefetch

ON

  • Specifies whether to prefetch archived data.

  • If you set this parameter to ON, OSS caches all archived data file blocks to the buffer pool when linear prefetching or random prefetching requirements are met. This reduces the frequency of access to OSS and improves access efficiency.

innodb_oss_prefetch_linear_pct_threshold

10%

  • The linear prefetch threshold of archive data.

  • When the number of sequentially read pages in an archived data block reaches the threshold, OSS directly caches the entire archived data file block to the buffer pool.

innodb_oss_prefetch_random_pct_threshold

30%

  • The random prefetch threshold of archive data.

  • When the number of randomly read pages in an archived data block reaches the threshold, OSS directly caches the entire archived data file block to the buffer pool.

innodb_oss_prefetch_task_limit

32

  • The upper limit of prefetch cache tasks.

  • Before an archived data file block is fully cached to the buffer pool, additional memory resources are required to store the archived data file block. A large value may cause high memory consumption.

oss_max_connections

64

  • The maximum number of HTTP connections that are allowed when your RDS instance accesses the OSS bucket.

  • In high-concurrency scenarios, a large value accelerates access to the OSS bucket. However, a large value causes high CPU consumption, memory consumption, and bandwidth consumption.

FAQ

Why does the [OSS] Size of tables is less than 6291456 error message appear when I execute the ALTER statement on my RDS instance?

The data size of an archived table on the RDS instance cannot be smaller than 6 MB.