-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compactor): Compactor potential oom risk of builder (#16802)
- Loading branch information
Showing
13 changed files
with
202 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,6 @@ use std::time::Duration; | |
|
||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use foyer::HybridCacheBuilder; | ||
use futures::future::try_join_all; | ||
use itertools::Itertools; | ||
use rand::random; | ||
use risingwave_common::catalog::TableId; | ||
use risingwave_common::config::{MetricLevel, ObjectStoreConfig}; | ||
|
@@ -118,17 +116,14 @@ async fn build_tables<F: SstableWriterFactory>( | |
.await | ||
.unwrap(); | ||
} | ||
let split_table_outputs = builder.finish().await.unwrap(); | ||
let ssts = split_table_outputs | ||
.iter() | ||
.map(|handle| handle.sst_info.sst_info.clone()) | ||
.collect_vec(); | ||
let join_handles = split_table_outputs | ||
|
||
builder | ||
.finish() | ||
.await | ||
.unwrap() | ||
.into_iter() | ||
.map(|o| o.upload_join_handle) | ||
.collect_vec(); | ||
try_join_all(join_handles).await.unwrap(); | ||
ssts | ||
.map(|info| info.sst_info) | ||
.collect() | ||
} | ||
|
||
async fn generate_sstable_store(object_store: Arc<ObjectStoreImpl>) -> Arc<SstableStore> { | ||
|
@@ -160,23 +155,38 @@ async fn generate_sstable_store(object_store: Arc<ObjectStoreImpl>) -> Arc<Sstab | |
|
||
fn bench_builder( | ||
c: &mut Criterion, | ||
bucket: &str, | ||
capacity_mb: usize, | ||
enable_streaming_upload: bool, | ||
local: bool, | ||
) { | ||
let runtime = tokio::runtime::Builder::new_current_thread() | ||
.enable_all() | ||
.build() | ||
.unwrap(); | ||
|
||
let metrics = Arc::new(ObjectStoreMetrics::unused()); | ||
|
||
let default_config = Arc::new(ObjectStoreConfig::default()); | ||
|
||
let object_store = runtime.block_on(async { | ||
S3ObjectStore::new_with_config(bucket.to_string(), metrics.clone(), default_config.clone()) | ||
if local { | ||
S3ObjectStore::new_minio_engine( | ||
"minio://hummockadmin:[email protected]:9301/hummock001", | ||
metrics.clone(), | ||
default_config.clone(), | ||
) | ||
.await | ||
.monitored(metrics, default_config) | ||
} else { | ||
S3ObjectStore::new_with_config( | ||
env::var("S3_BUCKET").unwrap(), | ||
metrics.clone(), | ||
default_config.clone(), | ||
) | ||
.await | ||
.monitored(metrics, default_config) | ||
} | ||
}); | ||
|
||
let object_store = Arc::new(ObjectStoreImpl::S3(object_store)); | ||
|
||
let sstable_store = runtime.block_on(async { generate_sstable_store(object_store).await }); | ||
|
@@ -216,10 +226,11 @@ fn bench_builder( | |
// SST size: 4, 32, 64, 128, 256MiB | ||
fn bench_multi_builder(c: &mut Criterion) { | ||
let sst_capacities = vec![4, 32, 64, 128, 256]; | ||
let bucket = env::var("S3_BUCKET").unwrap(); | ||
let is_local_test = env::var("LOCAL_TEST").is_ok(); | ||
|
||
for capacity in sst_capacities { | ||
bench_builder(c, &bucket, capacity, false); | ||
bench_builder(c, &bucket, capacity, true); | ||
bench_builder(c, capacity, false, is_local_test); | ||
bench_builder(c, capacity, true, is_local_test); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.