Updated on 2023-09-07 GMT+08:00

High Storage Usage

If the storage usage of a DDS instance is too high or fully used, the instance becomes unavailable.

This section describes how to analyze and fix high storage usage.

Checking the Storage Usage

DDS provides the following two methods to check the storage usage of an instance:

  1. Check the storage usage on the DDS console.

    You can log in to the DDS console and click the instance. On the Basic Information page, you can view the storage space of the instance in the Storage Space area.

    Figure 1 Checking the storage usage
  2. View the monitoring metrics (storage usage and used storage).

    To view monitoring metrics, see Viewing Monitoring Metrics.

    Figure 2 Checking the storage usage

Solution

  1. For cluster instances, data may be unevenly distributed because the database collection is not properly sharded. As a result, the storage usage is high.

    To shard the database collection properly, see How Do I Improve Database Performance by Configuring Sharding?

  2. As service data increases, the original database storage is insufficient. You can expand the storage space to fix this problem.

    If the storage space has reached the upper limit of your instance class, change the instance class first.

  3. If a large number of expired files occupy the storage space, delete the expired files in time. For example, if the entire database is no longer used, run dropDatabase to delete it.
  4. The background data processing mechanism is faulty.

    Operations such as write, update, and delete (including index insert and delete) are actually converted to write operations in the background. When data of an instance in use is deleted, the disk space is not reclaimed. Such unreclaimed disk space is called disk fragments. When new data is inserted, these fragments are reused without applying for new disk space. Different underlying storage engines (RocksDB and WiredTiger) vary according to specific scenarios.

    After deleting data, RocksDB directly converts the delete operation to append write. After a certain amount of redundant data is accumulated, the background compact thread is automatically triggered to merge and aggregate data of multiple versions to release redundant disk space. You are advised to wait for the system to automatically reclaim the disk space. If the disk space usage is high and close to the read-only threshold, contact Huawei technical support.

    After deleting data, WiredTiger merges and aggregates data of multiple versions, causing disk space fragments. However, WiredTiger does not return the disk space to the operating system. WiredTiger marks the disk space for subsequent writes of the current collection, the reserved disk space is preferentially used for subsequent writes of the collection. To release the disk space, run the compact command. (Note: This command blocks normal services and is disabled by default.)