Skip to content

Add cluster benchmark support to Resp.benchmark#1906

Open
vazois wants to merge 45 commits into
mainfrom
vazois/cluster-bench
Open

Add cluster benchmark support to Resp.benchmark#1906
vazois wants to merge 45 commits into
mainfrom
vazois/cluster-bench

Conversation

@vazois

@vazois vazois commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a --cluster-bench mode to Resp.benchmark for benchmarking Garnet cluster deployments.

Features

  • Cluster topology discovery: Automatically discovers shards, slot ranges, and replicas via CLUSTER NODES
  • Two architectures:
    • Sharded mode: Dedicated threads per shard with slot-aware key generation
    • Worker pool mode (--pool): Workers distribute operations across all shards
  • Offline & online modes: Pre-generated RESP buffers (offline) or on-the-fly generation (online)
  • Broadcast mode (--broadcast): Pipeline requests to all shards before completing, maximizing overlap
  • Mixed workload: --replica-ops-percent pipelines writes to primary + reads to replica in parallel
  • Multiple client types: LightClient, GarnetClientSession, GarnetClient, SERedis
  • Operations: GET, SET, MGET, MSET, INCR, DEL
  • Metrics: Kops/sec, data GB/s, wire Gbps, per-shard breakdown, latency percentiles (p50-p99.9), hit rates, primary/replica throughput split

Key files

  • ClusterBench/ClusterWorkloadDriver.cs — Orchestrator (topology, load, config, final reports)
  • ClusterBench/ClientRequestProvider.cs — RESP command generation, routing
  • ClusterBench/ClientRequestProvider.{Offline,Online,WorkerPool}.cs — Mode-specific execution
  • ClusterBench/Worker.cs — Worker thread orchestration
  • ClusterBench/SlotKeyGenerator.cs — Slot-aware key generation with hash-tag prefixes
  • ClusterBench/ClusterManager.cs — Topology discovery and slot mapping

Usage examples

# Basic cluster benchmark (3 shards, 8 threads/shard, offline)
Resp.benchmark --cluster-bench -h 127.0.0.1 -p 7000 --op SET -t 8 --dbsize 65536

# Worker pool with broadcast
Resp.benchmark --cluster-bench -h 127.0.0.1 -p 7000 --op GET -t 16 --dbsize 65536 --pool --broadcast

# Mixed workload with replicas (50% reads to replica)
Resp.benchmark --cluster-bench -h 127.0.0.1 -p 7000 --op SET -t 8 --dbsize 65536 --pool --replica-ops-percent 50

Copilot AI review requested due to automatic review settings June 30, 2026 18:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants