-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(stream): add hash join memory benchmarking for cache refill (#19712
- Loading branch information
Showing
7 changed files
with
370 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,3 +89,5 @@ e2e_test/iceberg/metastore_db | |
|
||
# mdbook | ||
book | ||
|
||
dhat-heap.json |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2024 RisingWave Labs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#![feature(let_chains)] | ||
|
||
//! To run this benchmark you can use the following command: | ||
//! ```sh | ||
//! cargo bench --features dhat-heap --bench stream_hash_join | ||
//! ``` | ||
//! | ||
//! You may also specify the amplification size, e.g. 40000 | ||
//! ```sh | ||
//! cargo bench --features dhat-heap --bench stream_hash_join -- 40000 | ||
//! ``` | ||
use std::env; | ||
|
||
use risingwave_stream::executor::test_utils::hash_join_executor::*; | ||
|
||
risingwave_expr_impl::enable!(); | ||
|
||
#[cfg(feature = "dhat-heap")] | ||
#[global_allocator] | ||
static ALLOC: dhat::Alloc = dhat::Alloc; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let args: Vec<_> = env::args().collect(); | ||
let amp = if let Some(raw_arg) = args.get(1) | ||
&& let Ok(arg) = raw_arg.parse() | ||
{ | ||
arg | ||
} else { | ||
100_000 | ||
}; | ||
let (tx_l, tx_r, out) = setup_bench_stream_hash_join(amp).await; | ||
{ | ||
// Start the profiler later, after we have ingested the data for hash join build-side. | ||
#[cfg(feature = "dhat-heap")] | ||
let _profiler = dhat::Profiler::new_heap(); | ||
|
||
handle_streams(amp, tx_l, tx_r, out).await; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2024 RisingWave Labs | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#![feature(let_chains)] | ||
|
||
//! To run this benchmark you can use the following command: | ||
//! ```sh | ||
//! cargo bench --bench stream_hash_join_rt | ||
//! ``` | ||
use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; | ||
use futures::executor::block_on; | ||
use risingwave_stream::executor::test_utils::hash_join_executor::*; | ||
use tokio::runtime::Runtime; | ||
|
||
risingwave_expr_impl::enable!(); | ||
|
||
fn bench_hash_join(c: &mut Criterion) { | ||
let mut group = c.benchmark_group("benchmark_hash_join"); | ||
group.sample_size(10); | ||
|
||
let rt = Runtime::new().unwrap(); | ||
for amp in [10_000, 20_000, 30_000, 40_000, 100_000, 200_000, 400_000] { | ||
let name = format!("hash_join_rt_{}", amp); | ||
group.bench_function(&name, |b| { | ||
b.to_async(&rt).iter_batched( | ||
|| block_on(setup_bench_stream_hash_join(amp)), | ||
|(tx_l, tx_r, out)| handle_streams(amp, tx_l, tx_r, out), | ||
BatchSize::SmallInput, | ||
) | ||
}); | ||
} | ||
} | ||
|
||
criterion_group!(benches, bench_hash_join); | ||
criterion_main!(benches); |
Oops, something went wrong.