-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
97 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use test_helpers::docker_compose::DockerCompose; | ||
use test_helpers::kafka_producer_perf_test::run_producer_bench; | ||
use test_helpers::shotover_process::ShotoverProcessBuilder; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
test_helpers::bench::init(); | ||
|
||
let config_dir = "tests/test-configs/kafka/passthrough"; | ||
{ | ||
let _compose = DockerCompose::new(&format!("{}/docker-compose.yaml", config_dir)); | ||
let shotover = | ||
ShotoverProcessBuilder::new_with_topology(&format!("{}/topology.yaml", config_dir)) | ||
.start() | ||
.await; | ||
|
||
println!("Benching Shotover ..."); | ||
run_producer_bench("[localhost]:9192"); | ||
|
||
shotover.shutdown_and_then_consume_events(&[]).await; | ||
} | ||
|
||
// restart the docker container to avoid running out of disk space | ||
let _compose = DockerCompose::new(&format!("{}/docker-compose.yaml", config_dir)); | ||
println!("\nBenching Direct Kafka ..."); | ||
run_producer_bench("[localhost]:9092"); | ||
} |
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,32 @@ | ||
use test_helpers::docker_compose::DockerCompose; | ||
use test_helpers::flamegraph::Perf; | ||
use test_helpers::kafka_producer_perf_test::run_producer_bench; | ||
use test_helpers::shotover_process::ShotoverProcessBuilder; | ||
|
||
// To get useful results you will need to modify the Cargo.toml like: | ||
// [profile.release] | ||
// #lto = "fat" | ||
// codegen-units = 1 | ||
// debug = true | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
test_helpers::bench::init(); | ||
let config_dir = "tests/test-configs/kafka/passthrough"; | ||
{ | ||
let _compose = DockerCompose::new(&format!("{}/docker-compose.yaml", config_dir)); | ||
|
||
let shotover = | ||
ShotoverProcessBuilder::new_with_topology(&format!("{}/topology.yaml", config_dir)) | ||
.start() | ||
.await; | ||
|
||
let perf = Perf::new(shotover.child.as_ref().unwrap().id().unwrap()); | ||
|
||
println!("Benching Shotover ..."); | ||
run_producer_bench("[localhost]:9192"); | ||
|
||
shotover.shutdown_and_then_consume_events(&[]).await; | ||
perf.flamegraph(); | ||
} | ||
} |
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,19 @@ | ||
use crate::run_command_to_stdout; | ||
|
||
pub fn run_producer_bench(address_bench: &str) { | ||
run_command_to_stdout( | ||
"kafka-producer-perf-test.sh", | ||
&[ | ||
"--producer-props", | ||
&format!("bootstrap.servers={address_bench}"), | ||
"--record-size", | ||
"1000", | ||
"--throughput", | ||
"-1", | ||
"--num-records", | ||
"5000000", | ||
"--topic", | ||
"foo", | ||
], | ||
); | ||
} |
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