solana-labs / solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
https://solanalabs.com
Apache License 2.0
12.97k stars 4.17k forks source link

Mitigate RocksDB IO spike when rpc-history is enabled #33961

Open yhchiang-sol opened 10 months ago

yhchiang-sol commented 10 months ago

Problem

When rpc-history is enabled on a validator, blockstore will create additional RocksDB column families. The keys of those rpc-related column families are pubkey-prefixed for faster prefix-scan operation. As a result, their underlying RocksDB SST files are not sorted by slot and thus their disk space reclaiming is less performant than other slot-based column families as our disk space reclaiming logic is slot-based.

This makes IO spikes when the periodic compaction starts.

Proposed Solution

The problem is fundamentally challenging as it's impossible to have one key format that satisfies both read and compaction as they require different key prefixes. However, the IO spike issue can be mitigated by using RocksDB's RateLimiter which will smooth out the IO spikes.

yhchiang-sol commented 10 months ago

Created https://github.com/facebook/rocksdb/pull/12058 to expose auto-tuned RateLimiter in RocksDB's C API.