Disk Optimization

CosVM Node Configuration for Disk Usage Optimization

When setting up a validator node for CosVM, it's crucial to optimize configuration settings to reduce disk space requirements while maintaining essential functionalities. The blockchain database tends to expand over time due to factors like block speed and transaction volume. However, by customizing certain settings, you can significantly lower the disk usage without compromising the node's performance.

Indexing Optimization

If your node doesn’t require transaction querying, disabling indexing can save substantial disk space. To achieve this, modify the config.toml file:

indexer = "null"

Note: If you disable indexing on a synced node, manually delete the index located at data/tx_index.db/ under the database directory.

State-Sync Snapshots

Ensure that state-sync snapshots are disabled to prevent unnecessary data accumulation. In the app.toml file, set:

snapshot-interval = 0 

Note: Enabling state-sync could facilitate rapid syncing for new nodes but sacrifices historical data.

Configure Pruning

Customize pruning settings to optimize disk usage over time. Adjust the pruning configurations in config.toml:

pruning = "custom"
pruning-keep-recent = "100"
pruning-keep-every = "0"
pruning-interval = "10"

Caution: Avoid setting pruning-keep-recent = "0" to prevent potential database corruption if the CosVM node is unexpectedly terminated.

Logging Optimization

Reduce unnecessary log data by adjusting the log level. Initially set to info, switch it to a lower level after confirming successful node syncing in config.toml:

log_level = "warn" 

Ensure proper log rotation settings for efficient log management.

Results Comparison

Here's a comparison of disk usage after two weeks on the CosVM mainnet:

Default Configuration:

5.3G    ./state.db
70G     ./application.db
20K     ./snapshots/metadata.db
24K     ./snapshots
9.0G    ./blockstore.db
20K     ./evidence.db
1018M   ./cs.wal
4.7G    ./tx_index.db
90G     .

Optimized Configuration:

17G     .
1.1G    ./cs.wal
946M    ./application.db
20K     ./evidence.db
9.1G    ./blockstore.db
24K     ./snapshots
20K     ./snapshots/metadata.db
5.3G    ./state.db

Implementing these customized configurations reduces disk usage significantly from 90GB to 17GB while ensuring essential data is retained for optimal CosVM node performance. Adjustments like disabling unnecessary features, optimizing pruning, and minimizing logs can effectively manage disk space without compromising the node's functionality.

Last updated