diff --git a/src/storage/benches/bench_multi_builder.rs b/src/storage/benches/bench_multi_builder.rs index 891976963041..fe58f0c011db 100644 --- a/src/storage/benches/bench_multi_builder.rs +++ b/src/storage/benches/bench_multi_builder.rs @@ -35,7 +35,7 @@ use risingwave_storage::hummock::iterator::{ConcatIterator, ConcatIteratorInner, use risingwave_storage::hummock::multi_builder::{CapacitySplitTableBuilder, TableBuilderFactory}; use risingwave_storage::hummock::value::HummockValue; use risingwave_storage::hummock::{ - BackwardSstableIterator, BatchSstableWriterFactory, CachePolicy, FileCache, HummockResult, + BackwardSstableIterator, BatchSstableWriterFactory, CachePolicy, HummockResult, MemoryLimiter, SstableBuilder, SstableBuilderOptions, SstableIteratorReadOptions, SstableStore, SstableStoreConfig, SstableWriterFactory, SstableWriterOptions, StreamingSstableWriterFactory, Xor16FilterBuilder, @@ -131,23 +131,33 @@ async fn build_tables( ssts } -fn generate_sstable_store(object_store: Arc) -> SstableStore { - SstableStore::new(SstableStoreConfig { +async fn generate_sstable_store(object_store: Arc) -> Arc { + let meta_cache_v2 = HybridCacheBuilder::new() + .memory(64 << 20) + .with_shards(2) + .storage() + .build() + .await + .unwrap(); + let block_cache_v2 = HybridCacheBuilder::new() + .memory(128 << 20) + .with_shards(2) + .storage() + .build() + .await + .unwrap(); + Arc::new(SstableStore::new(SstableStoreConfig { store: object_store, path: "test".to_string(), - block_cache_capacity: 64 << 20, - meta_cache_capacity: 128 << 20, - meta_cache_shard_num: 2, - block_cache_shard_num: 2, - block_cache_eviction: EvictionConfig::for_test(), - meta_cache_eviction: EvictionConfig::for_test(), prefetch_buffer_capacity: 64 << 20, max_prefetch_block_number: 16, - data_file_cache: FileCache::none(), - meta_file_cache: FileCache::none(), recent_filter: None, - state_store_metrics: Arc::new(global_hummock_state_store_metrics(MetricLevel::Disabled)), - }) + state_store_metrics: Arc::new(global_hummock_state_store_metrics( + MetricLevel::Disabled, + )), + meta_cache_v2, + block_cache_v2, + })) } fn bench_builder( @@ -171,34 +181,8 @@ fn bench_builder( }); let object_store = Arc::new(ObjectStoreImpl::S3(object_store)); - let sstable_store = runtime.block_on(async { - let meta_cache_v2 = HybridCacheBuilder::new() - .memory(64 << 20) - .with_shards(2) - .storage() - .build() - .await - .unwrap(); - let block_cache_v2 = HybridCacheBuilder::new() - .memory(128 << 20) - .with_shards(2) - .storage() - .build() - .await - .unwrap(); - Arc::new(SstableStore::new(SstableStoreConfig { - store: object_store, - path: "test".to_string(), - prefetch_buffer_capacity: 64 << 20, - max_prefetch_block_number: 16, - recent_filter: None, - state_store_metrics: Arc::new(global_hummock_state_store_metrics( - MetricLevel::Disabled, - )), - meta_cache_v2, - block_cache_v2, - })) + generate_sstable_store(object_store).await }); let mut group = c.benchmark_group("bench_multi_builder"); @@ -255,7 +239,9 @@ fn bench_table_scan(c: &mut Criterion) { Arc::new(ObjectStoreConfig::default()), ); let object_store = Arc::new(ObjectStoreImpl::InMem(store)); - let sstable_store = Arc::new(generate_sstable_store(object_store)); + let sstable_store = runtime.block_on(async { + generate_sstable_store(object_store).await + }); let ssts = runtime.block_on(async { build_tables(CapacitySplitTableBuilder::for_test(