All Products
Search
Document Center

Database Autonomy Service:Storage analysis

Last Updated:Mar 08, 2024

Timely detection and resolution of storage-related issues is an important task for database O&M. 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 with the sum of index storage and data space greater than 1 GB and the fragmentation percentage greater than 20%.

    • 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.

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

View the recycling results

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

References

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