The storage analysis feature in Database Autonomy Service (DAS) gives you visibility into storage usage across your MongoDB instance — from instance-level totals and growth trends down to per-collection fragmentation rates. When fragmentation accumulates, you can recycle tablespace fragments directly from the DAS console to reclaim disk space and prevent performance degradation.
Supported instances
Before you use this feature, confirm that your instance meets the following requirements:
Instance type: Self-managed MongoDB database, or ApsaraDB for MongoDB replica set or sharded cluster instance of a supported version (see the table below)
Connection state: Connected to DAS and in the Normal Access state. For more information, see Database instances.
Supported ApsaraDB for MongoDB versions
| Major version | Minor version | Supported |
|---|---|---|
| MongoDB 4.0 | 3.0.x | No |
| MongoDB 4.2 | 4.0.0–4.0.22 | No |
| MongoDB 4.2 | 4.0.23 and later | Yes |
| MongoDB 4.4 using Database File System (DBFS) | All | No |
| MongoDB 4.4 | 5.0.0–5.0.6 | No |
| MongoDB 4.4 | 5.0.7 and later | Yes |
| MongoDB 5.0 | All | Yes |
| MongoDB 6.0 | All | Yes |
View storage information
Use the Storage Analysis page to monitor three types of storage health signals:
| When you want to... | Go to |
|---|---|
| Check overall disk health: total used space, average daily growth rate within the previous seven days, and days until full | Storage Overview > Storage section |
| Identify tables or collections with storage exceptions | Storage Overview > Exceptions section |
| Analyze storage growth over the past seven days | Storage Overview > Storage Trend section |
| Inspect per-table storage usage, fields, and indexes | Storage Overview > Tablespaces section |
| View storage usage per database and its tablespace breakdown; click a table name to view its fields and indexes | Data Space tab |
To open the Storage Analysis page:
Log on to the DAS console.
In the left-side navigation pane, click Instance Monitoring.
Find the instance and click its instance ID.
In the left-side navigation pane, click Storage Analysis.
Click the Storage Overview or Data Space tab.
In the Storage section, hover over the
icon to see details for each metric.
Recycle tablespace fragments
When a collection's fragmentation rate is high, recycling tablespace fragments frees up disk space. DAS runs the compact command on the target collection to perform the recycling.
Tablespace fragment recycling only works on hidden nodes. To recycle fragments on a primary or secondary node, you must first switch that node to a hidden node. To switch nodes, see Primary/Secondary switchover. To run compact manually on any node, see Defragment the disks of an instance to increase disk utilization.
Choose automatic or manual recycling
| Automatic recycling | Manual recycling | |
|---|---|---|
| How it triggers | DAS scans hidden nodes during the maintenance window and runs compact on qualifying collections | You initiate recycling on a specific collection |
| Qualifying conditions | Index + data storage > 1 GB and fragmentation rate > 20% | Any collection you select |
| Per-node cap | 100 GB per hidden node per recycling round | No cap per operation |
| Best for | Many collections with small recyclable space | Collections with large recyclable space, especially those exceeding 100 GB |
Set up automatic recycling
Log on to the DAS console.
In the left-side navigation pane, click Instance Monitoring.
Find the instance and click its instance ID.
In the left-side navigation pane, click Storage Analysis.
In the Tablespaces section, find the table and click Recycle in the Fragmentation Rate column.
In the Recycle dialog box, configure an automatic recycling plan and specify a maintenance window.
During each maintenance window, DAS scans hidden node collections and runs compact on collections where index and data storage exceeds 1 GB and the fragmentation rate exceeds 20%. The total recyclable space processed per hidden node per round is capped at 100 GB. If a collection's recyclable space exceeds 100 GB, recycle it manually instead.
Recycle fragments manually
Log on to the DAS console.
In the left-side navigation pane, click Instance Monitoring.
Find the instance and click its instance ID.
In the left-side navigation pane, click Storage Analysis.
In the Tablespaces section, find the table and click Recycle in the Fragmentation Rate column.
In the Recycle dialog box, go to the Collection with High Fragmentation Rate section.
Find the collection and click Recycle in the Actions column.
Select Execute Now or Run in the O & M window.
Recycling limits and recommendations
Recycling is not immediate. DAS runs
compactin the background, and the duration depends on the amount of fragmentation.Recycle up to 10 collections per batch. Wait for the current recycling task to finish before starting the next one — running too many concurrent tasks may cause failures.
Collections with a low fragmentation rate may yield limited space savings after recycling.
If recyclable space exceeds 100 GB, the recycling task may take more than one hour. Schedule it during a low-traffic period.
If a cache eviction error occurs during recycling, the instance encountered cache pressure and the compact operation exited early. Reschedule the task at a different time. If the task fails repeatedly, submit a ticket.
Verify recycling results
After the recycling task completes, click Re-analyze to view the updated storage statistics. Check whether the fragmentation rate and used space have decreased.
API reference
| Operation | Description |
|---|---|
| CreateStorageAnalysisTask | Creates a storage analysis task to query storage usage details for databases and tables. |
| GetStorageAnalysisResult | Queries the status and results of a storage analysis task. |
What's next
For MongoDB instances that don't support storage analysis (instances earlier than MongoDB 4.0, or instances not using replica set or sharded cluster topology), see Defragment the disks of an instance to increase disk utilization.