-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Ledger Store Benchmark) Enable FIFO Compaction in the benchmark #22162
Conversation
Here're some example logs showing the effectiveness of the FIFO compaction. I will run more benchmarks comparing its results with other settings:
|
Codecov Report
@@ Coverage Diff @@
## master #22162 +/- ##
=========================================
- Coverage 81.3% 81.2% -0.1%
=========================================
Files 567 567
Lines 154287 154287
=========================================
- Hits 125456 125433 -23
- Misses 28831 28854 +23 |
ledger/src/blockstore_db.rs
Outdated
match options.shred_storage_type { | ||
ShredStorageType::RocksLevel => { | ||
new_cf_descriptor::<ShredData>(&access_type, &oldest_slot) | ||
} | ||
ShredStorageType::RocksFifo => { | ||
if options.shred_data_cf_size > FIFO_WRITE_BUFFER_SIZE { | ||
new_cf_descriptor_fifo::<ShredData>(&options.shred_data_cf_size) | ||
} else { | ||
warn!( | ||
"shred_data_cf_size is must be greater than {} for RocksFifo.", | ||
FIFO_WRITE_BUFFER_SIZE | ||
); | ||
warn!("Fall back to ShredStorageType::RocksLevel for cf::ShredData."); | ||
new_cf_descriptor::<ShredData>(&access_type, &oldest_slot) | ||
} | ||
} | ||
}, | ||
match options.shred_storage_type { | ||
ShredStorageType::RocksLevel => { | ||
new_cf_descriptor::<ShredCode>(&access_type, &oldest_slot) | ||
} | ||
ShredStorageType::RocksFifo => { | ||
if options.shred_code_cf_size > FIFO_WRITE_BUFFER_SIZE { | ||
new_cf_descriptor_fifo::<ShredCode>(&options.shred_code_cf_size) | ||
} else { | ||
warn!( | ||
"shred_code_cf_size is must be greater than {} for RocksFifo.", | ||
FIFO_WRITE_BUFFER_SIZE | ||
); | ||
warn!("Fall back to ShredStorageType::RocksLevel for cf::ShredCode."); | ||
new_cf_descriptor::<ShredCode>(&access_type, &oldest_slot) | ||
} | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we extract this into a common function that takes a generic T
to distinguish between ShredCode
and ShredData
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code was on its stacked PR which is already landed.
I've created #23103 for this.
ledger/src/blockstore_db.rs
Outdated
pub shred_data_cf_size: u64, | ||
// The maximum storage size for storing coding shreds in column family | ||
// [`cf::CodeShred`]. Typically, coding shreds contribute around 20% of the | ||
// ledger store storage size if the RPC service is enabled, or 40% if RPC | ||
// service is not enabled. | ||
// | ||
// Currently, this setting is only used when shred_storage_type is set to | ||
// [`ShredStorageType::RocksFifo`]. | ||
pub shred_code_cf_size: u64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these two fields are only necessary when FIFO compaction is enabled, how about a separate struct FifoCompactionOptions
, and we have an optional field here: fifo_compaction_options: Option<FifoCompactionOptions>
. Then the default is None
for leveled compaction, which communicates the dependency between these fields and fifo compaction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are from its parent PR (which is already merged.). I will incorporate the comments in a separate PR.
Summary of Changes
This PR enables FIFO Compaction in the test_ledger_cleanup_compaction benchmark.
Note that this PR is based on top of two stack PRs: #22108 and #22140.
To enable FIFO compaction, the following arguments should be set:
FIFO_COMPACTION=true
CLEANUP_SERVICE=false
SHRED_DATA_CF_SIZE=10000000000 // this controls when to delete the oldest SST file.
Example command to use FIFO compaction in the benchmark:
BENCHMARK_SLOTS=10000000 NUM_WRITERS=9 BATCH_SIZE=1 SHREDS_PER_SLOT=25 PRE_GENERATE_DATA=false CLEANUP_BLOCKSTORE=false CLEANUP_SERVICE=false FIFO_COMPACTION=true SHRED_DATA_CF_SIZE=10000000000 cargo test --release tests::test_ledger_cleanup_compaction -- --exact --nocapture
Observed the FIFO compaction working properly by checking the output and the RocksDB LOG file.