Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windsock move to bench #1297

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ rustflags = [
linker = "aarch64-linux-gnu-gcc"

[alias]
windsock = "run --release --example windsock --"
windsock = "test --release --bench windsock --features alpha-transforms --"
windsock-debug = "test --bench windsock --features alpha-transforms --"
4 changes: 4 additions & 0 deletions shotover-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ time = { version = "0.3.25" }
# Include WIP alpha transforms in the public API
alpha-transforms = ["shotover/alpha-transforms"]
cassandra-cpp-driver-tests = ["test-helpers/cassandra-cpp-driver-tests"]

[[bench]]
name = "windsock"
harness = false
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::{
};
use test_helpers::docker_compose::get_image_waiters;
use tokio::sync::RwLock;
use tokio_bin_process::bin_path;
use tokio_bin_process::event::{Event, Level};
use windsock::ReportArchive;

Expand Down Expand Up @@ -128,35 +129,11 @@ sudo apt-get install -y sysstat"#,
)
.await;

// PROFILE is set in build.rs from PROFILE listed in https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
let profile = if env!("PROFILE") == "release" {
"release"
} else {
"dev"
};
let output = tokio::process::Command::new(env!("CARGO"))
.args(["build", "--all-features", "--profile", profile])
.output()
.await
.unwrap();
if !output.status.success() {
let stdout = String::from_utf8(output.stdout).unwrap();
let stderr = String::from_utf8(output.stderr).unwrap();
panic!("Bench run failed:\nstdout:\n{stdout}\nstderr:\n{stderr}")
}
let local_shotover_path = bin_path!("shotover-proxy");
instance
.instance
.ssh()
.push_file(
&std::env::current_exe()
.unwrap()
.parent()
.unwrap()
.parent()
.unwrap()
.join("shotover-proxy"),
Path::new("shotover-bin"),
)
.push_file(local_shotover_path, Path::new("shotover-bin"))
.await;
instance
.instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use test_helpers::{
shotover_process::ShotoverProcessBuilder,
};
use tokio::sync::mpsc::UnboundedSender;
use tokio_bin_process::bin_path;
use windsock::{Bench, BenchParameters, BenchTask, Profiling, Report};

const ROW_COUNT: usize = 1000;
Expand Down Expand Up @@ -549,8 +550,9 @@ impl Bench for CassandraBench {
let shotover = match self.shotover {
Shotover::Standard => Some(
ShotoverProcessBuilder::new_with_topology(&format!("{config_dir}/topology.yaml"))
.with_cores(core_count.shotover as u32)
.with_bin(bin_path!("shotover-proxy"))
.with_profile(profiler.shotover_profile())
.with_cores(core_count.shotover as u32)
.start()
.await,
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::aws::{Ec2InstanceWithDocker, Ec2InstanceWithShotover};
use crate::common::{rewritten_file, Shotover};
use crate::profilers::{self, CloudProfilerRunner, ProfilerRunner};
use crate::shotover::shotover_process;
use anyhow::Result;
use async_trait::async_trait;
use aws_throwaway::ec2_instance::Ec2Instance;
Expand All @@ -12,7 +13,7 @@ use rdkafka::util::Timeout;
use std::path::Path;
use std::sync::Arc;
use std::{collections::HashMap, time::Duration};
use test_helpers::{docker_compose::docker_compose, shotover_process::ShotoverProcessBuilder};
use test_helpers::docker_compose::docker_compose;
use tokio::{sync::mpsc::UnboundedSender, task::JoinHandle, time::Instant};
use windsock::{Bench, BenchParameters, Profiling, Report};

Expand Down Expand Up @@ -124,20 +125,12 @@ impl Bench for KafkaBench {

let mut profiler = ProfilerRunner::new(self.name(), profiling);
let shotover = match self.shotover {
Shotover::Standard => Some(
ShotoverProcessBuilder::new_with_topology(&format!("{config_dir}/topology.yaml"))
.with_profile(profiler.shotover_profile())
.start()
.await,
),
Shotover::Standard => {
Some(shotover_process(&format!("{config_dir}/topology.yaml"), &profiler).await)
}
Shotover::None => None,
Shotover::ForcedMessageParsed => Some(
ShotoverProcessBuilder::new_with_topology(&format!(
"{config_dir}/topology-encode.yaml"
))
.with_profile(profiler.shotover_profile())
.start()
.await,
shotover_process(&format!("{config_dir}/topology-encode.yaml"), &profiler).await,
),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod common;
mod kafka;
mod profilers;
mod redis;
mod shotover;

use crate::cassandra::*;
use crate::common::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{
aws::{Ec2InstanceWithDocker, Ec2InstanceWithShotover, RunningShotover, WindsockAws},
common::{rewritten_file, Shotover},
profilers::{self, CloudProfilerRunner, ProfilerRunner},
shotover::shotover_process,
};
use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
Expand All @@ -23,7 +24,7 @@ use std::{
};
use test_helpers::{
docker_compose::docker_compose,
shotover_process::{Count, EventMatcher, Level, ShotoverProcessBuilder},
shotover_process::{Count, EventMatcher, Level},
};
use tokio::sync::mpsc::UnboundedSender;
use windsock::{Bench, BenchParameters, BenchTask, Profiling, Report};
Expand Down Expand Up @@ -203,19 +204,11 @@ impl Bench for RedisBench {
let _compose = docker_compose(&format!("{config_dir}/docker-compose.yaml"));
let mut profiler = ProfilerRunner::new(self.name(), profiling);
let shotover = match self.shotover {
Shotover::Standard => Some(
ShotoverProcessBuilder::new_with_topology(&format!("{config_dir}/topology.yaml"))
.with_profile(profiler.shotover_profile())
.start()
.await,
),
Shotover::Standard => {
Some(shotover_process(&format!("{config_dir}/topology.yaml"), &profiler).await)
}
Shotover::ForcedMessageParsed => Some(
ShotoverProcessBuilder::new_with_topology(&format!(
"{config_dir}/topology-encode.yaml"
))
.with_profile(profiler.shotover_profile())
.start()
.await,
shotover_process(&format!("{config_dir}/topology-encode.yaml"), &profiler).await,
),
Shotover::None => None,
};
Expand Down
11 changes: 11 additions & 0 deletions shotover-proxy/benches/windsock/shotover.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use crate::profilers::ProfilerRunner;
use test_helpers::shotover_process::ShotoverProcessBuilder;
use tokio_bin_process::{bin_path, BinProcess};

pub async fn shotover_process(topology_path: &str, profiler: &ProfilerRunner) -> BinProcess {
ShotoverProcessBuilder::new_with_topology(topology_path)
.with_bin(bin_path!("shotover-proxy"))
.with_profile(profiler.shotover_profile())
.start()
.await
}
7 changes: 0 additions & 7 deletions shotover-proxy/build.rs

This file was deleted.

Loading