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.
Modes of operation:
The cassandra-stress tool creates a keyspace called Keyspace1 and within that, tables named Standard1, Super1, Counter1, and SuperCounter1, depending on what type of table is being tested. These are automatically created the first time you run the stress test and will be reused on subsequent runs unless you drop the keyspace using CQL or CLI. It is not possible to change the names; they are hard-coded.
You can use these modes with or without the cassandra-stress daemon running (binary installs only).
|Short option||Long option||Description|
|-V||--average-size-values||Generate column values of average rather than specific size.|
|-C <CARDINALITY>||--cardinality <CARDINALITY>||Number of unique values stored in columns. Default is 50.|
|-c <COLUMNS>||--columns <COLUMNS>||Number of columns per key. Default is 5.|
|-S <COLUMN-SIZE>||--column-size <COLUMN-SIZE>||Size of column values in bytes. Default is 34.|
|-Z <COMPACTION-STRATEGY>||--compaction-strategy <COMPACTION-STRATEGY>||Specifies which compaction strategy to use.|
|-U <COMPARATOR>||--comparator <COMPARATOR>||Specifies which column comparator to use. Supported types are: TimeUUIDType, AsciiType, and UTF8Type.|
|-I <COMPRESSION>||--compression <COMPRESSION>||Specifies the compression to use for SSTables. Default is no compression.|
|-e <CONSISTENCY-LEVEL>||--consistency-level <CONSISTENCY-LEVEL>||Consistency level to use (ONE, QUORUM, LOCAL_QUORUM, EACH_QUORUM, ALL, ANY). Default is ONE.|
|-x <CREATE-INDEX>||--create-index <CREATE-INDEX>||Type of index to create on columns (KEYS).|
|-L l||--enable-cql||Perform queries using CQL (Cassandra Query Language).|
|-y <TYPE>||--family-type <TYPE>||Sets the table type.|
|-f <FILE>||--file <FILE>||Write output to a given file.|
|-k||--keep-going||Ignore errors when inserting or reading. When set, --keep-trying has no effect. Default is false.|
|-K <KEEP-TRYING>||--keep-trying <KEEP-TRYING>||Retry on-going operation N times (in case of failure). Use a positive integer. The default is 10.|
|-g <KEYS-PER-CALL>||-g, --keys-per-call <KEYS-PER-CALL>||Number of keys to per call. Default is 1000.|
|-d <NODES>||--nodes <NODES>||Nodes to perform the test against. Must be comma separated with no spaces. Default is localhost.|
|-D <NODESFILE>||--nodesfile <NODESFILE>||File containing host nodes (one per line).|
|-W||--no-replicate-on-write||Set replicate_on_write to false for counters. Only for counters with a consistency level of ONE (CL=ONE). See Counter columns in Data modeling.|
|-F <NUM-DIFFERENT-KEYS>||--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.|
|-n <NUMKEYS>||--num-keys <NUMKEYS>||Number of keys to write or read. Default is 1,000,000.|
|-o <OPERATION>||--operation <OPERATION>||Operation to perform: INSERT, READ, INDEXED_RANGE_SLICE, MULTI_GET, COUNTER_ADD, COUNTER_GET. Default is INSERT.|
|-p <PORT>||--port <PORT>||Thrift port. Default is 9160.|
|-i <PROGRESS-INTERVAL>||--progress-interval <PROGRESS-INTERVAL>||The interval, in seconds, at which progress is output. Default is 10 seconds.|
|-Q <QUERY-NAMES>||--query-names <QUERY-NAMES>||Comma-separated list of column names to retrieve from each row.|
|-r||--random||Use random key generator. When used --stdev has no effect. Default is false.|
|-l <REPLICATION-FACTOR>||--replication-factor <REPLICATION-FACTOR>||Replication Factor to use when creating tables. Default is 1.|
|-R <REPLICATION-STRATEGY>||--replication-strategy <REPLICATION-STRATEGY>||Replication strategy to use (only on insert and when a keyspace does not exist.) The default is SimpleStrategy.|
|-T <SEND-TO>||--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.|
|-N <SKIP-KEYS>||--skip-keys <SKIP-KEYS>||Fraction of keys to skip initially. Default is 0.|
|-s <STDEV>||--stdev <STDEV>||Standard deviation. Default is 0.1.|
|-O <STRATEGY-PROPERTIES>||--strategy-properties <STRATEGY-PROPERTIES>||Replication strategy properties in the following format: <dc_name>:<num>,<dc_name>:<num>, .... For use with NetworkTopologyStrategy.|
|-t <THREADS>||--threads <THREADS>||Number of threads to use. Default is 50.|
|-m||--unframed||Use unframed transport. Default is false.|
|-P||--use-prepared-statements||(CQL only) Perform queries using prepared statements.|
Usage for the daemon mode in binary installs.
Run the daemon from:
<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.
/tools/bin/cassandra-stress -d 192.168.1.101
When the number of rows is not specified, one million rows are inserted.
tools/bin/cassandra-stress -d 192.168.1.101 -o read
/tools/bin/cassandra-stress -d 192.168.1.101,192.168.1.102 -n 10000000
/tools/bin/cassandra-stress -d 192.168.1.101,192.168.1.102 -n 10000000 --send-to 18.104.22.168
About the period output from the running tests.
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).
7251,725,725,56.1,95.1,191.8,10 19523,1227,1227,41.6,86.1,189.1,21 41348,2182,2182,22.5,75.7,176.0,31 ...
|total||Total number of operations since the start of the test.|
|interval_op_rate||Number of operations performed per second during the interval (default 10 seconds).|
|interval_key_rate||Number of keys/rows read or written per second during the interval (normally be the same as interval_op_rate unless doing range slices).|
|latency||Average latency for each operation during that interval.|
|95th||95% of the time the latency was less than the number displayed in the column (Cassandra 1.2 or later).|
|99th||99% of the time the latency was less than the number displayed in the column (Cassandra 1.2 or later).|
|elapsed||Number of seconds elapsed since the beginning of the test.|