Skip to content

Commit

Permalink
fix(storage): fix failed micro-bench (#15210)
Browse files Browse the repository at this point in the history
Signed-off-by: Little-Wallace <[email protected]>
  • Loading branch information
Little-Wallace authored Feb 26, 2024
1 parent 461f454 commit 1eec69e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mach2 = "0.4"
workspace-hack = { path = "../workspace-hack" }

[dev-dependencies]
criterion = { workspace = true, features = ["async_futures"] }
criterion = { workspace = true, features = ["async_futures", "async_tokio"] }
expect-test = "1"
moka = { version = "0.12", features = ["future"] }
risingwave_hummock_sdk = { workspace = true, features = ["enable_test_epoch"] }
Expand Down
28 changes: 21 additions & 7 deletions src/storage/benches/bench_compactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn bench_table_scan(c: &mut Criterion) {

c.bench_function("bench_table_iterator", |b| {
let info1 = info.clone();
b.to_async(FuturesExecutor)
b.to_async(&runtime)
.iter(|| scan_all_table(&info1, sstable_store.clone()));
});
}
Expand Down Expand Up @@ -223,15 +223,29 @@ fn bench_merge_iterator_compactor(c: &mut Criterion) {
let sstable_store = mock_sstable_store();
let test_key_size = 256 * 1024;
let info1 = runtime
.block_on(async { build_table(sstable_store.clone(), 1, 0..test_key_size, 1).await });
let info2 = runtime
.block_on(async { build_table(sstable_store.clone(), 2, 0..test_key_size, 1).await });
.block_on(async { build_table(sstable_store.clone(), 1, 0..test_key_size / 2, 1).await });
let info2 = runtime.block_on(async {
build_table(
sstable_store.clone(),
2,
test_key_size / 2..test_key_size,
1,
)
.await
});
let level1 = vec![info1, info2];

let info1 = runtime
.block_on(async { build_table(sstable_store.clone(), 3, 0..test_key_size, 2).await });
let info2 = runtime
.block_on(async { build_table(sstable_store.clone(), 4, 0..test_key_size, 2).await });
.block_on(async { build_table(sstable_store.clone(), 3, 0..test_key_size / 2, 2).await });
let info2 = runtime.block_on(async {
build_table(
sstable_store.clone(),
4,
test_key_size / 2..test_key_size,
2,
)
.await
});
let level2 = vec![info1, info2];
let read_options = Arc::new(SstableIteratorReadOptions {
cache_policy: CachePolicy::Fill(CachePriority::High),
Expand Down

0 comments on commit 1eec69e

Please sign in to comment.