All Products
Search
Document Center

Database Autonomy Service:Storage analysis

Last Updated:Jun 14, 2024

During database O&M, it is important to identify and resolve storage-related issues at the earliest opportunity. Database Autonomy Service (DAS) provides the storage analysis feature. You can use this feature to view the storage usage of a database instance and the storage information about each table in a database. This helps you identify storage exceptions at the earliest opportunity. DAS also allows you to recycle tablespace fragments to prevent disk space waste and performance degradation.

Prerequisites

  • The database instance that you want to manage is of one of the following types:

    • Self-managed MongoDB database

    • ApsaraDB for MongoDB instance

      Note

      Only replica set or sharded cluster instances that run MongoDB V4.0 or later are supported.

  • The database instance is connected to DAS and is in the Normal Access state. For more information, see Connect a database instance to DAS.

View information on the Storage Analysis page

  1. Log on to the DAS console.

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

  3. On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.

  4. In the left-side navigation pane, click Storage Analysis. On the page that appears, click the Storage Overview or Data Space tab. On the Storage Overview tab, you can view the storage statistics, exceptions, and storage trend of the instance. On the Data Space tab, you can view the storage usage.

    Tab

    Section

    Description

    Storage Overview

    Storage

    You can view information such as exceptions, the average daily increase of storage usage within the previous seven days, the number of days during which storage is available, and the total amount of used space.

    Note

    You can move your pointer over the image.png icon to view the details of each item.

    Exceptions

    You can view the exception information about tables or collections in the database instance.

    Storage Trend

    You can view the usage trend within a specific time range.

    Note

    The time range can be up to seven days.

    Tablespaces

    You can view the detailed information and storage usage of each table in the database instance. You can click the name of a table to view the fields and indexes of the table.

    Data Space

    You can view the storage usage of each database in the database instance and the usage of tablespaces in the database.

    You can click the name of a table to view the fields and indexes of the table.

Recycle tablespace fragments

Important

You can recycle tablespace fragments only of a hidden node. If you want to recycle tablespace fragments of a primary or secondary node, you must switch the primary or secondary node to the hidden node and then recycle tablespace fragments of the new hidden node. Alternatively, you can run the compact command on the tablespace fragments. For more information about how to switch nodes, see Primary/Secondary failover. For more information about how to run the compact command, see Defragment a disk to improve disk usage.

  1. Log on to the DAS console.

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

  3. On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.

  4. In the left-side navigation pane, click Storage Analysis.

  5. In the Tablespaces section, find the table that you want to manage. Click Recycle in the Fragmentation Rate column.

  6. In the Recycle dialog box, create the tablespace fragment recycling plan.

    • Automatic tablespace fragment recycling

      If you configure a plan to automatically recycle tablespace fragments for the instance, DAS automatically detects the collections of hidden nodes during the specified maintenance window, and then runs the compact command on the collections in which the sum of index and data storage usage exceeds 1 GB and the fragmentation rate is greater than 20%. To reduce the recycling time, the total amount of recyclable space in collections on each hidden node in a recycling plan each round cannot exceed 100 GB. If the recyclable space of a common table exceeds 100 GB, you must manually recycle tablespace fragments of the table.

    • Manual tablespace fragment recycling

      In the Collection with High Fragmentation Rate section, find the collection that you want to manage, and click Recycle in the Actions column. You can recycle the tablespace fragments by selecting Execute Now or Run in the O & M window.

    Note
    • The recycling operation is not immediately complete. In actual situations, DAS runs the compact command in the backend for a period of time to gradually recycle the tablespace fragments. The recycling period depends on the size of the tablespace fragments to be recycled. More tablespace fragments require a longer recycling period.

    • We recommend that you recycle up to 10 collections at a time and initiate the next recycling task after the current recycling task is complete. Otherwise, the recycling task may fail.

    • If the fragmentation rate of a collection is relatively small, the collection may be recycled in a less effective manner.

    • If the number of collections with relatively small recyclable space is large, we recommend that you configure a plan to automatically recycle tablespace fragments of the collections. If the recyclable space of a collection is relatively large, we recommend that you manually recycle tablespace fragments of the collection. If the recyclable space of a collection exceeds 100 GB, it may take more than 1 hour to recycle tablespace fragments of the collection. Appropriately arrange the recycling time.

View the recycling results

After the recycling task is complete, click Re-analyze to view the results.

FAQ

Q: What do I do if the (Interrupted) Compaction interrupted on table:*** due to cache eviction pressure error message appears?

A: The instance whose tablespace fragments you want to recycle is of an earlier version and has low specifications. When you run the compact command on the instance, the instance fails due to a large amount of cached data. If a recycling task fails, you can select a time to restart the task. If the task fails multiple times, submit a ticket.

References

The storage analysis feature is supported only for MongoDB replica set or sharded cluster database instances whose database version is MongoDB V4.0 or later. For more information about how to recycle tablespace fragments of other MongoDB instances, see Defragment a disk to improve disk usage.

Related API operations

Operation

Description

CreateStorageAnalysisTask

Creates a storage analysis task to query the usage details of databases and tables.

GetStorageAnalysisResult

Queries the status and results of a storage analysis task.