Skip to content

Commit

Permalink
Merge branch 'main' into query_counter_remove_redis_specific
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Jan 31, 2024
2 parents 131fed0 + adc3c02 commit c6eeb5c
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 116 deletions.
80 changes: 80 additions & 0 deletions shotover-proxy/benches/windsock/cassandra/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
mod bench;

use crate::common::*;
use crate::ShotoverBench;
use bench::*;

pub fn benches() -> Vec<ShotoverBench> {
let mut result = vec![
Box::new(CassandraBench::new(
CassandraDb::Mocked,
CassandraTopology::Single,
Shotover::None,
Compression::None,
Operation::ReadI64,
CassandraProtocol::V4,
CassandraDriver::Scylla,
10,
)) as ShotoverBench,
Box::new(CassandraBench::new(
CassandraDb::Mocked,
CassandraTopology::Single,
Shotover::Standard,
Compression::None,
Operation::ReadI64,
CassandraProtocol::V4,
CassandraDriver::Scylla,
10,
)),
];
result.extend(
itertools::iproduct!(
[CassandraDb::Cassandra],
[CassandraTopology::Single, CassandraTopology::Cluster3],
[Shotover::None, Shotover::Standard],
[Compression::None, Compression::Lz4],
[Operation::ReadI64, Operation::WriteBlob],
[
CassandraProtocol::V3,
CassandraProtocol::V4,
CassandraProtocol::V5
],
[CassandraDriver::Scylla, CassandraDriver::CdrsTokio],
[1, 10, 100]
)
.filter_map(
|(
cassandra,
topology,
shotover,
compression,
operation,
protocol,
driver,
connection_count,
)| {
if driver == CassandraDriver::Scylla && protocol != CassandraProtocol::V4 {
return None;
}

if driver == CassandraDriver::CdrsTokio
&& (operation != Operation::ReadI64 || topology != CassandraTopology::Single)
{
return None;
}

Some(Box::new(CassandraBench::new(
cassandra,
topology,
shotover,
compression,
operation,
protocol,
driver,
connection_count,
)) as ShotoverBench)
},
),
);
result
}
File renamed without changes.
25 changes: 25 additions & 0 deletions shotover-proxy/benches/windsock/kafka/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
mod bench;

use crate::common::*;
use crate::ShotoverBench;
use bench::*;

pub fn benches() -> Vec<ShotoverBench> {
itertools::iproduct!(
[
Shotover::None,
Shotover::Standard,
Shotover::ForcedMessageParsed
],
[
KafkaTopology::Single,
KafkaTopology::Cluster1,
KafkaTopology::Cluster3
],
[Size::B1, Size::KB1, Size::KB100]
)
.map(|(shotover, topology, size)| {
Box::new(KafkaBench::new(shotover, topology, size)) as ShotoverBench
})
.collect()
}
122 changes: 6 additions & 116 deletions shotover-proxy/benches/windsock/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@ mod profilers;
mod redis;
mod shotover;

use crate::cassandra::*;
use crate::common::*;
#[cfg(feature = "rdkafka-driver-tests")]
use crate::kafka::*;
use crate::redis::*;
use cloud::CloudResources;
use cloud::CloudResourcesRequired;
use std::path::Path;
use tracing_subscriber::EnvFilter;
use windsock::{Bench, Windsock};

type ShotoverBench = Box<
pub type ShotoverBench = Box<
dyn Bench<CloudResourcesRequired = CloudResourcesRequired, CloudResources = CloudResources>,
>;

Expand All @@ -41,117 +36,12 @@ fn main() {
.unwrap();
}

let cassandra_benches = itertools::iproduct!(
[CassandraDb::Cassandra],
[CassandraTopology::Single, CassandraTopology::Cluster3],
[Shotover::None, Shotover::Standard],
[Compression::None, Compression::Lz4],
[Operation::ReadI64, Operation::WriteBlob],
[
CassandraProtocol::V3,
CassandraProtocol::V4,
CassandraProtocol::V5
],
[CassandraDriver::Scylla, CassandraDriver::CdrsTokio],
[1, 10, 100]
)
.filter_map(
|(
cassandra,
topology,
shotover,
compression,
operation,
protocol,
driver,
connection_count,
)| {
if driver == CassandraDriver::Scylla && protocol != CassandraProtocol::V4 {
return None;
}

if driver == CassandraDriver::CdrsTokio
&& (operation != Operation::ReadI64 || topology != CassandraTopology::Single)
{
return None;
}
let mut benches = vec![];

Some(Box::new(CassandraBench::new(
cassandra,
topology,
shotover,
compression,
operation,
protocol,
driver,
connection_count,
)) as ShotoverBench)
},
);
benches.extend(cassandra::benches());
#[cfg(feature = "rdkafka-driver-tests")]
let kafka_benches = itertools::iproduct!(
[
Shotover::None,
Shotover::Standard,
Shotover::ForcedMessageParsed
],
[
KafkaTopology::Single,
KafkaTopology::Cluster1,
KafkaTopology::Cluster3
],
[Size::B1, Size::KB1, Size::KB100]
)
.map(|(shotover, topology, size)| {
Box::new(KafkaBench::new(shotover, topology, size)) as ShotoverBench
});
#[cfg(not(feature = "rdkafka-driver-tests"))]
let kafka_benches = std::iter::empty();

let redis_benches = itertools::iproduct!(
[RedisTopology::Cluster3, RedisTopology::Single],
[
Shotover::None,
Shotover::Standard,
Shotover::ForcedMessageParsed
],
[RedisOperation::Get, RedisOperation::Set],
[Encryption::None, Encryption::Tls]
)
.map(|(topology, shotover, operation, encryption)| {
Box::new(RedisBench::new(topology, shotover, operation, encryption)) as ShotoverBench
});
benches.extend(kafka::benches());
benches.extend(redis::benches());

Windsock::new(
vec![
Box::new(CassandraBench::new(
CassandraDb::Mocked,
CassandraTopology::Single,
Shotover::None,
Compression::None,
Operation::ReadI64,
CassandraProtocol::V4,
CassandraDriver::Scylla,
10,
)) as ShotoverBench,
Box::new(CassandraBench::new(
CassandraDb::Mocked,
CassandraTopology::Single,
Shotover::Standard,
Compression::None,
Operation::ReadI64,
CassandraProtocol::V4,
CassandraDriver::Scylla,
10,
)),
]
.into_iter()
.chain(cassandra_benches)
.chain(kafka_benches)
.chain(redis_benches)
.collect(),
cloud::AwsCloud::new_boxed(),
&["release"],
)
.run();
Windsock::new(benches, cloud::AwsCloud::new_boxed(), &["release"]).run();
}
File renamed without changes.
22 changes: 22 additions & 0 deletions shotover-proxy/benches/windsock/redis/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
mod bench;

use crate::common::*;
use crate::ShotoverBench;
use bench::*;

pub fn benches() -> Vec<ShotoverBench> {
itertools::iproduct!(
[RedisTopology::Cluster3, RedisTopology::Single],
[
Shotover::None,
Shotover::Standard,
Shotover::ForcedMessageParsed
],
[RedisOperation::Get, RedisOperation::Set],
[Encryption::None, Encryption::Tls]
)
.map(|(topology, shotover, operation, encryption)| {
Box::new(RedisBench::new(topology, shotover, operation, encryption)) as ShotoverBench
})
.collect()
}

0 comments on commit c6eeb5c

Please sign in to comment.