From 8d75e7c8c8eacaa34f378f26593d3151dfa88de0 Mon Sep 17 00:00:00 2001 From: Lucas Kent Date: Tue, 10 Mar 2026 12:13:12 +1100 Subject: [PATCH] Fix running example benches on mac os --- windsock/benches/windsock/cassandra.rs | 23 +++++++++++++------ .../config/cassandra-1-docker-compose.yaml | 23 ++++--------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/windsock/benches/windsock/cassandra.rs b/windsock/benches/windsock/cassandra.rs index 5e4b7b9..6316f30 100644 --- a/windsock/benches/windsock/cassandra.rs +++ b/windsock/benches/windsock/cassandra.rs @@ -52,9 +52,8 @@ impl Bench for CassandraBench { fn tags(&self) -> HashMap { [ ("db".to_owned(), "cassandra".to_owned()), - ("topology".to_owned(), "1".to_owned()), self.topology.to_tag(), - ("message_type".to_owned(), "write1000bytes".to_owned()), + ("query".to_owned(), "read_system_peers".to_owned()), ( "compression".to_owned(), match &self.compression { @@ -84,9 +83,18 @@ impl Bench for CassandraBench { _profiling: Profiling, parameters: BenchParameters, ) -> Result<()> { - let _docker_compose = - docker_compose("benches/windsock/config/cassandra-1-docker-compose.yaml"); - let address = "127.0.0.1:9042"; + let _docker_compose = match self.topology { + Topology::Single => { + docker_compose("benches/windsock/config/cassandra-1-docker-compose.yaml") + } + Topology::Cluster3 => { + docker_compose("benches/windsock/config/cassandra-3-docker-compose.yaml") + } + }; + let address = match self.topology { + Topology::Single => "127.0.0.1:9042", + Topology::Cluster3 => "172.16.1.2:9042", + }; self.execute_run(address, ¶meters).await; @@ -95,13 +103,14 @@ impl Bench for CassandraBench { async fn run_bencher( &self, - _resources: &str, + resources: &str, parameters: BenchParameters, reporter: UnboundedSender, ) { + let address = resources; let session = Arc::new( SessionBuilder::new() - .known_nodes(["172.16.1.2:9042"]) + .known_nodes([address]) // We do not need to refresh metadata as there is nothing else fiddling with the topology or schema. // By default the metadata refreshes every 60s and that can cause performance issues so we disable it by using an absurdly high refresh interval .cluster_metadata_refresh_interval(Duration::from_secs(10000000000)) diff --git a/windsock/benches/windsock/config/cassandra-1-docker-compose.yaml b/windsock/benches/windsock/config/cassandra-1-docker-compose.yaml index 5215bd1..8252c0d 100644 --- a/windsock/benches/windsock/config/cassandra-1-docker-compose.yaml +++ b/windsock/benches/windsock/config/cassandra-1-docker-compose.yaml @@ -1,25 +1,12 @@ -networks: - cluster_subnet: - name: cluster_subnet - driver: bridge - ipam: - driver: default - config: - - subnet: 172.16.1.0/24 - gateway: 172.16.1.1 - services: cassandra-one: - image: &image shotover/cassandra-test:4.0.6-r1 - networks: - cluster_subnet: - ipv4_address: 172.16.1.2 - environment: &environment + image: shotover/cassandra-test:4.0.6-r1 + ports: + - "9042:9042" + environment: MAX_HEAP_SIZE: "400M" MIN_HEAP_SIZE: "400M" HEAP_NEWSIZE: "48M" volumes: - # Using volume instead of tmpfs adds 3 seconds to the runtime of the cassandra standard_test_suite but allows running tests that restart nodes - &volumes - - type: volume + - type: tmpfs target: /var/lib/cassandra