Stress Testing Apache Cassandra Database

Go to apache cassandra installation folder > tools > bin > cassandra-stress

Below is a simple stress test script that prints out the stats to a file in Ubuntu with dstat installed.


Pretty self explanatory.


Below are some references taken from with regards to the stress tool

The cassandra-stress tool is a Java-based stress testing utility for benchmarking and load testing a Cassandra cluster. The binary installation of the tool also includes a daemon, which in larger-scale testing can prevent potential skews in the test results by keeping the JVM warm.

There are different modes of operation:

  • Inserting: Loads test data.
  • Reading: Reads test data.
  • Indexed range slicing: Works with RandomParititioner on indexed column families.

You can use these modes with or without the cassandra-stressd daemon running (binary installs only).


  • Packaged installs: cassandra-stress [options]
  • Binary installs: <install_location>/tools/bin/cassandra-stress [options]

The available options are:

Long Option

Short Option



Generate column values of average rather than specific size.
–cardinality <CARDINALITY>


Number of unique values stored in columns. Default is 50.
–columns <COLUMNS>


Number of columns per key. Default is 5.
–column-size <COLUMN-SIZE>


Size of column values in bytes. Default is 34.
–compaction-strategy <COMPACTION-STRATEGY>


Specifies which compaction strategy to use.
–comparator <COMPARATOR>


Specifies which column comparator to use. Supported types are: TimeUUIDType, AsciiType, and UTF8Type.
–compression <COMPRESSION>


Specifies the compression to use for SSTables. Default is no compression.
–consistency-level <CONSISTENCY-LEVEL>


Consistency level to use (ONE, QUORUM, LOCAL_QUORUM, EACH_QUORUM, ALL, ANY). Default is ONE.
–create-index <CREATE-INDEX>


Type of index to create on column families (KEYS).


Perform queries using CQL (Cassandra Query Language).
–family-type <TYPE> -y <TYPE>Sets the column family type.
–file <FILE>

-f <FILE>

Write output to a given file.


Show help.


Ignore errors when inserting or reading. When set, –keep-trying has no effect. Default is false.
–keep-trying <KEEP-TRYING>


Retry on-going operation N times (in case of failure). Use a positive integer. The default is 10.
–keys-per-call <KEYS-PER-CALL>


Number of keys to per call. Default is 1000.
–nodes <NODES>

-d <NODES>

Nodes to perform the test against. Must be comma separated with no spaces. Default is localhost.
–nodesfile <NODESFILE>


File containing host nodes (one per line).


Set replicate_on_write to false for counters. Only for counters with a consistency level of ONE (CL=ONE).
–num-different-keys <NUM-DIFFERENT-KEYS>


Number of different keys. If less than NUM-KEYS, the same key is re-used multiple times. Default is NUM-KEYS.
–num-keys <NUMKEYS>


Number of keys to write or read. Default is 1,000,000.
–operation <OPERATION>


–port <PORT>

-p <PORT>

Thrift port. Default is 9160.
–progress-interval <PROGRESS-INTERVAL>


The interval, in seconds, at which progress is output. Default is 10 seconds.
–query-names <QUERY-NAMES>


Comma-separated list of column names to retrieve from each row.


Use random key generator. When used –stdev has no effect. Default is false.
–replication-factor <REPLICATION-FACTOR>>


Replication Factor to use when creating column families. Default is 1.
–replication-strategy <REPLICATION-STRATEGY>


Replication strategy to use (only on insert and when a keyspace does not exist.) Default is: SimpleStrategy.
–send-to <SEND-TO>


Sends the command as a request to the cassandra-stressd daemon at the specified IP address. The daemon must already be running at that address.
–skip-keys <SKIP-KEYS>


Fraction of keys to skip initially. Default is 0.
–stdev <STDEV>

-s <STDEV>

Standard deviation. Default is 0.1.
–strategy-properties <STRATEGY-PROPERTIES>


Replication strategy properties in the following format: <dc_name>:<num>,<dc_name>:<num>,… For use with NetworkTopologyStrategy.
–threads <THREADS>


Number of threads to use. Default is 50.


Use unframed transport. Default is false.


(CQL only) Perform queries using prepared statements.

Using the Daemon Mode

Usage for the daemon mode in binary installs:

<install_location>/tools/bin/cassandra-stressd start|stop|status [-h <host>]

During stress testing, you can keep the daemon running and send it commands through it using the --send-to option.


  • Inserts 1,000,000 rows to given host:

    /tools/bin/cassandra-stress -d

    When the number of rows is not specified, one million rows are inserted.

  • Read 1,000,000 rows from given host:

    tools/bin/cassandra-stress -d -o read

  • Insert 10,000,000 rows across two nodes:

    /tools/bin/cassandra-stress -d, -n 10000000

  • Insert 10,000,000 rows across two nodes using the daemon mode:

    /tools/bin/cassandra-stress -d, -n 10000000 --send-to

Interpreting the output of cassandra-stress

The cassandra-stress tool periodically outputs information about the running tests. For example:

Each line reports data for the interval between the last elapsed time and current elapsed time, which is set by the --progress-interval option (default 10 seconds). The following explains this information:

  • total: the total number of operations since the start of the test.
  • interval_op_rate: the number of operations performed during the interval.
  • interval_key_rate: the number of keys/rows read or written during the interval (normally be the same as interval_op_rate unless doing range slices).
  • latency: the average latency for each operation during that interval.
  • elapsed: the number of seconds elapsed since the beginning of the test.




Leave a Reply