This wrapper facilitates the automated execution of the Apache Cassandra stress benchmark. Apache Cassandra is an open-source, distributed NoSQL database designed for handling large volumes of data across many commodity servers. The cassandra-stress tool is Cassandra's built-in benchmarking utility for testing write and read throughput under configurable workloads.
The wrapper provides:
- Automated Cassandra download, installation, and execution.
- Configurable mixed read/write workload ratios.
- Customizable thread counts with automatic CPU-aware defaults.
- Multi-iteration testing with averaged results.
- Result collection, processing, and verification.
- CSV and JSON output formats.
- System configuration metadata capture.
- Integration with test_tools framework.
- Optional Performance Co-Pilot (PCP) integration.
Cassandra Options:
--run_time <minutes>: How long to run each test for. Default is 4 minutes.
--threads <t1,t2...>: Comma separated list of the number of threads to run.
Default is 1 to ncpus, intervals of 8, unless less than 8 cpus, then each cpu.
--tests <write=a,read=b:write=c,read=d>...: Test definitions to run.
Default is: write=1,read=0:write=1,read=1:write=1,read=3
General test_tools options:
--home_parent <value>: Parent home directory. If not set, defaults to current working directory.
--host_config <value>: Host configuration name, defaults to current hostname.
--iterations <value>: Number of times to run the test, defaults to 1.
--run_user: User that is actually running the test on the test system. Defaults to current user.
--sys_type: Type of system working with (aws, azure, hostname). Defaults to hostname.
--sysname: Name of the system running, used in determining config files. Defaults to hostname.
--tuned_setting: Used in naming the results directory. For RHEL, defaults to current active tuned profile.
For non-RHEL systems, defaults to 'none'.
--use_pcp: Enable Performance Co-Pilot monitoring during test execution.
--tools_git <value>: Git repo to retrieve the required tools from.
Default: https://github.com/redhat-performance/test_tools-wrappers
--usage: Display this usage message.
The cassandra_run script performs the following workflow:
-
Environment Setup:
- Clones the test_tools-wrappers repository if not present (default: ~/test_tools).
- Sources error codes and general setup utilities.
- Gathers system hardware information.
-
Package Installation:
- Installs required dependencies via package_tool.
- Dependencies are defined in cassandra.json for different OS variants (RHEL).
-
Cassandra Download & Installation:
- Downloads Apache Cassandra 5.0.8 binary tarball from https://downloads.apache.org/cassandra/.
- Extracts the archive and sets up executables (cassandra, cassandra-stress).
- Creates the required logs directory.
- Skips download if the Cassandra directory already exists.
-
Service Startup:
- Starts the Cassandra service via systemctl.
- Waits until Cassandra is fully active before proceeding.
-
Thread Configuration:
- If no thread list is specified, automatically generates thread counts.
- For systems with fewer than 8 CPUs, tests each CPU count (1 to ncpus).
- For systems with 8+ CPUs, generates 8 evenly spaced intervals up to ncpus.
-
Test Execution:
- Runs
cassandra-stress mixedfor each combination of test definition, thread count, and iteration. - Each test runs for the configured duration (default: 4 minutes).
- Test definitions control the read/write ratio (e.g.,
write=1,read=3means 75% reads, 25% writes). - Records timestamps for each test run.
- Optionally records PCP performance data during execution.
- Runs
-
Data Collection:
- Captures raw output from each run in
cassandra_iter_<iter>_threads_<threads>_<test>.outfiles. - Extracts the "Op rate" (operations per second) metric from each run.
- Captures raw output from each run in
-
Result Processing:
- Averages Op rate across all iterations for each test/thread combination.
- Generates CSV files with configuration metadata and performance data.
- Creates JSON output for verification.
- Validates results against Pydantic schema (result_schema.py).
-
Verification:
- Validates results against Pydantic schema ensuring:
- Thread count is a positive integer.
- Operations per second is a positive integer.
- Timestamps are valid datetime objects.
- Uses csv_to_json and verify_results from test_tools.
- Validates results against Pydantic schema ensuring:
-
Output:
- Saves all raw output files, processed CSV/JSON, and system metadata.
- Optionally saves PCP performance data.
- Archives results to configured storage location.
Location of underlying workload: https://downloads.apache.org/cassandra/
General packages required: chkconfig (RHEL)
Runtime requirements: Apache Cassandra requires Java (JDK 11 or 17) to be pre-installed.
To run:
git clone https://github.com/redhat-performance/cassandra-wrapper
cd cassandra-wrapper/cassandra
./cassandra_runThe script will automatically detect your CPU configuration, download Cassandra, and run all default workloads.
The cassandra-stress tool measures Cassandra's throughput under configurable mixed read/write workloads. It connects to a local Cassandra instance and drives operations at the specified thread concurrency.
The wrapper runs three workload profiles by default:
-
write=1,read=0: Pure write workload (100% writes). Measures maximum write throughput.
-
write=1,read=1: Balanced read/write workload (50% writes, 50% reads). Measures mixed operation throughput.
-
write=1,read=3: Read-heavy workload (25% writes, 75% reads). Measures read-dominated throughput.
Each test run reports:
-
Op rate: Operations per second — the primary throughput metric. Higher values indicate better performance.
-
Latency: Response time statistics (mean, median, 95th/99th/99.9th percentile, max) for each operation type.
-
Total partitions: Number of partitions written/read during the test.
-
Total errors: Number of failed operations (should be 0 for a healthy system).
The wrapper extracts and averages the Op rate across iterations for the final results.
The results directory contains:
- results_cassandra.csv: CSV file with all test performance metrics (test, threads, ops_sec, start/end timestamps)
- results_cassandra.json: JSON file with validated results data
- cassandra_iter_*threads*_*.out: Raw cassandra-stress output files from each test run
- meta_data*.yml: System metadata (CPU info, memory, kernel version)
- PCP data (if --use_pcp option used): Performance Co-Pilot monitoring data
./cassandra_runThis runs with:
- Apache Cassandra 5.0.8
- 3 workload profiles (write-only, balanced, read-heavy)
- 4-minute duration per test
- Auto-detected thread counts based on CPU count
- 1 iteration
./cassandra_run --threads 1,4,8,16Runs all workloads with 1, 4, 8, and 16 threads specifically.
./cassandra_run --run_time 10Runs each test for 10 minutes instead of the default 4 minutes, producing more stable results.
./cassandra_run --iterations 3Runs the complete test suite 3 times and averages the results for consistency validation.
./cassandra_run --tests "write=1,read=0:write=1,read=9"Runs a pure write test and a 90% read / 10% write test.
./cassandra_run --use_pcpCollects Performance Co-Pilot data during the run for detailed performance analysis.
./cassandra_run --run_time 10 --threads 1,2,4,8 --iterations 3 --use_pcpRuns 3 iterations of all workloads with specified thread counts, 10-minute duration, and PCP monitoring.
When no --threads option is provided:
- Systems with < 8 CPUs: Tests every thread count from 1 to ncpus (e.g., on a 4-core system: 1, 2, 3, 4).
- Systems with 8+ CPUs: Generates 8 evenly spaced intervals from 1 to ncpus (e.g., on a 64-core system: 1, 8, 16, 24, 32, 40, 48, 56, 64).
This approach balances test coverage with reasonable execution time.
When running multiple iterations (--iterations > 1):
- Each iteration produces a complete set of results for all test/thread combinations.
- Raw results are saved in separate cassandra_iter_* files.
- The wrapper extracts the Op rate from each iteration.
- Final results are the arithmetic mean across all iterations.
This approach:
- Reduces impact of transient system effects
- Provides more reliable performance measurements
- Helps identify result variance across runs
The script uses standardized error codes from test_tools error_codes:
- 0: Success
- 101: Git clone failure
- E_GENERAL: General execution errors (Cassandra start failure, CSV conversion failure)
- E_VALIDATION_FAIL: Results schema validation failure
- E_USAGE: Invalid usage/arguments
Exit codes indicate specific failure points for automated testing workflows.
- Linux: x86_64 and aarch64 architectures
- OS Support: RHEL
- Cassandra Version: 5.0.8 (hardcoded in wrapper)
- Cassandra stress tests are I/O and CPU intensive
- Write-only workloads (
write=1,read=0) typically show the highest Op rates - Read-heavy workloads (
write=1,read=3) stress the storage subsystem more - Thread scaling shows how well Cassandra utilizes available CPU cores
- Run multiple iterations (--iterations 3 or higher) for reliable results
- Ensure system is idle during testing for best consistency
The test definition write=W,read=R controls the operation mix:
- write=1,read=0: 100% writes
- write=1,read=1: 50% writes, 50% reads
- write=1,read=3: 25% writes, 75% reads
- The ratio is
W:(W+R)writes andR:(W+R)reads
- Run multiple test iterations (--iterations 3+) to verify consistency
- Ensure system is idle (no other workloads) for best results
- Consider the active tuned profile on RHEL systems
- Use longer run times (--run_time 10+) for more stable throughput numbers
- PCP monitoring (--use_pcp) adds minimal overhead but provides detailed metrics
- Allow Cassandra to warm up — the first iteration may show lower throughput
- If Cassandra fails to start, verify Java (JDK 11 or 17) is installed
- If cassandra-stress fails, check Cassandra logs in
apache-cassandra-<version>/logs/ - If results seem inconsistent, run more iterations and check system load during testing
- Use --use_pcp to collect detailed performance counters for analysis
- Check cassandra_iter_* files for detailed error messages and latency breakdowns
- For upstream Cassandra issues, see: https://cassandra.apache.org/
- Apache Cassandra: https://cassandra.apache.org/
- Cassandra Downloads: https://downloads.apache.org/cassandra/
- Cassandra Stress Documentation: https://cassandra.apache.org/doc/latest/cassandra/tools/cassandra_stress.html
- test_tools Framework: https://github.com/redhat-performance/test_tools-wrappers