cockroach workload as described below.
The
cockroach workload command is experimental. The interface and output are subject to change.Synopsis
Create the schema for a workload:Subcommands
| Command | Usage |
|---|---|
init | Load the schema for the workload. You run this command once for a given schema. |
run | Run a workload. You can run this command multiple times from different machines to increase concurrency. See Concurrency for more details. |
Concurrency
There are two ways to increase the concurrency of a workload:- Increase the concurrency of a single workload instance by running
cockroach workload run <workload>with the--concurrencyflag set to a value higher than the default. Note that not all workloads support this flag. - Run multiple instances of a workload in parallel by running
cockroach workload run <workload>multiple times from different terminals/machines.
Workloads
| Workload | Description |
|---|---|
bank | Models a set of accounts with currency balances. For this workload, you run workload init to load the schema and then workload run to generate data. |
intro | Loads an intro database, with one table, mytable, with a hidden message.For this workload, you run only workload init to load the data. The workload run subcommand is not applicable. |
kv | Reads and writes to keys spread (by default, uniformly at random) across the cluster. For this workload, you run workload init to load the schema and then workload run to generate data. |
movr | Simulates a workload for the . For this workload, you run workload init to load the schema and then workload run to generate data. |
startrek | Loads a startrek database, with two tables, episodes and quotes.For this workload, you run only workload init to load the data. The workload run subcommand is not applicable. |
tpcc | Simulates a transaction processing workload using a rich schema of multiple tables. For this workload, you run workload init to load the schema and then workload run to generate data. |
ycsb | Simulates a high-scale key value workload, either read-heavy, write-heavy, or scan-based, with additional customizations. For this workload, you run workload init to load the schema and then workload run to generate data. |
cockroach workload sets the for its workload queries to the name of the workload that is used. You can filter queries on application_name on the , or in a statement.Flags
Thecockroach workload command does not support connection or security flags like other . Instead, you must use a at the end of the command.
All workloads
All workloads support the following flags:| Flag | Description |
|---|---|
--max-conn-lifetime | The maximum duration of a connection. Default: 300s |
--max-conn-lifetime-jitter | The maximum jitter when tearing down a connection. Default: 30s |
--max-conn-idle-time | The maximum idle time for a connection. Default: 150s |
--conn-healthcheck-period | The connection health check interval. Default: 30s |
--min-conns | The minimum number of connections in the connection pool. Default: 0 |
bank workload
| Flag | Description |
|---|---|
--concurrency | The number of concurrent workers. Applicable commands: init or runDefault: 2 * number of CPUs |
--db | The SQL database to use. Applicable commands: init or runDefault: bank |
--display-every | The frequency for printing per-operation statistics. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 1s |
--display-format | The format for printing per-operation statistics (simple, incremental-json). When using incremental-json, note that totals are not printed at the end of the workload’s duration.Applicable command: runDefault: simple |
--drop | Drop the existing database, if it exists. Applicable commands: init or run. For the run command, this flag must be used in conjunction with --init. |
--duration | The duration to run, with a required time unit suffix. Valid time units are ns, us, ms, s, m, and h.Applicable commands: init or runDefault: 0, which means run forever. |
--histograms | The file to write per-op incremental and cumulative histogram data to. Applicable command: run |
--init | Deprecated. Use the init command instead.Applicable command: run |
--max-ops | The maximum number of operations to run. Applicable command: run |
--max-rate | The maximum frequency of operations (reads/writes). Applicable command: runDefault: 0, which means unlimited. |
--payload-bytes | The size of the payload field in each initial row. Applicable commands: init or runDefault: 100 |
--ramp | The duration over which to ramp up load. Applicable command: run |
--ranges | The initial number of ranges in the bank table.Applicable commands: init or runDefault: 10 |
--rows | The initial number of accounts in the bank table.Applicable commands: init or runDefault: 1000 |
--seed | The key hash seed. Applicable commands: init or runDefault: A random seed is used each time the command is run. Reusing a seed is recommended only for reproducing a specific pattern or behavior. Workloads that have a random element should use the default random seed. |
--tolerate-errors | Keep running on error. Applicable command: run |
intro and startrek workloads
These workloads generate data but do not offer the ability to run continuous load. Thus, only the
init subcommand is supported.| Flag | Description |
|---|---|
--drop | Drop the existing database, if it exists, before loading the dataset. |
kv workload
| Flag | Description | |
|---|---|---|
--batch | The number of blocks to insert in a single SQL statement. Applicable commands: init or runDefault: 1 | |
--concurrency | The number of concurrent workers. Applicable commands: init or runDefault: 8 --cycle-length | The number of keys repeatedly accessed by each writer.Applicable commands: init or runDefault: 9223372036854775807 |
--db | The SQL database to use. Applicable commands: init or runDefault: kv | |
--display-every | The frequency for printing per-operation statistics. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 1s | |
--display-format | The format for printing per-operation statistics (simple, incremental-json). When using incremental-json, note that totals are not printed at the end of the workload’s duration.Applicable command: runDefault: simple | |
--drop | Drop the existing database, if it exists. Applicable commands: init or run | |
--duration | The duration to run, with a required time unit suffix. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 0, which means run forever. | |
--histograms | The file to write per-op incremental and cumulative histogram data to. Applicable command: run | |
--init | Deprecated. Use the init command instead.Applicable command: run | |
--max-block-bytes | The maximum amount of raw data written with each insertion. Applicable commands: init or runDefault: 2 | |
--max-ops | The maximum number of operations to run. Applicable command: run | |
--max-rate | The maximum frequency of operations (reads/writes). Applicable command: runDefault: 0, which means unlimited. | |
--min-block-bytes | The minimum amount of raw data written with each insertion. Applicable commands: init or runDefault: 1 | |
--ramp | The duration over which to ramp up load. Applicable command: run | |
--read-percent | The percent (0-100) of operations that are reads of existing keys. Applicable commands: init or run | |
--seed | The key hash seed. Applicable commands: init or runDefault: A random seed is used each time the command is run. Reusing a seed is recommended only for reproducing a specific pattern or behavior. Workloads that have a random element should use the default random seed. | |
--sequential | Pick keys sequentially instead of randomly. Applicable commands: init or run | |
--splits | The number of splits to perform before starting normal operations. Applicable commands: init or run | |
--tolerate-errors | Keep running on error. Applicable command: run | |
--use-opt | Use . Applicable commands: init or runDefault: true | |
--write-seq | Initial write sequence value. Applicable commands: init or run |
movr workload
| Flag | Description |
|---|---|
--data-loader | How to load initial table data. Valid options are INSERT and IMPORT.Applicable commands: init or runDefault: INSERT |
--db | The SQL database to use. Applicable commands: init or runDefault: movr |
--display-every | The frequency for printing per-operation statistics. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 1s |
--display-format | The format for printing per-operation statistics (simple, incremental-json). When using incremental-json, note that totals are not printed at the end of the workload’s duration.Applicable command: runDefault: simple |
--drop | Drop the existing database, if it exists. Applicable commands: init or run |
--duration | The duration to run, with a required time unit suffix. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 0, which means run forever. |
--histograms | The file to write per-op incremental and cumulative histogram data to. Applicable command: run |
--histograms-max-latency | Expected maximum latency of running a query, with a required time unit suffix. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 1m40s |
--max-ops | The maximum number of operations to run. Applicable command: run |
--max-rate | The maximum frequency of operations (reads/writes). Applicable command: runDefault: 0, which means unlimited. |
--method | The SQL issue method (prepare, noprepare, simple).Applicable commands: init or runDefault: prepare |
--num-histories | The initial number of ride location histories. Applicable commands: init or runDefault: 1000 |
--num-promo-codes | The initial number of promo codes. Applicable commands: init or runDefault: 1000 |
--num-rides | Initial number of rides. Applicable commands: init or runDefault: 500 |
--num-users | Initial number of users. Applicable commands: init or runDefault: 50 |
--num-vehicles | Initial number of vehicles. Applicable commands: init or runDefault: 15 |
--ramp | The duration over which to ramp up load. Applicable command: run |
--seed | The random number generator seed. Applicable commands: init or runDefault: A random seed is used each time the command is run. Reusing a seed is recommended only for reproducing a specific pattern or behavior. Workloads that have a random element should use the default random seed. |
--tolerate-errors | Keep running on error. Applicable command: run |
tpcc workload
| Flag | Description |
|---|---|
--active-warehouses | Run the load generator against a specific number of warehouses. Applicable commands: init or runDefaults: Value of --warehouses |
--concurrency | The number of concurrent workers. Applicable commands: init or runDefault: 16 |
--data-loader | How to load initial table data. Valid options are INSERT and IMPORT.Applicable commands: init or runDefault: INSERT |
--db | The SQL database to use. Applicable commands: init or runDefault: tpcc |
--display-every | The frequency for printing per-operation statistics. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 1s |
--display-format | The format for printing per-operation statistics (simple, incremental-json). When using incremental-json, note that totals are not printed at the end of the workload’s duration.Applicable command: runDefault: simple |
--drop | Drop the existing database, if it exists. Applicable commands: init or run. For the run command, this flag must be used in conjunction with --init. |
--duration | The duration to run, with a required time unit suffix. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 0, which means run forever. |
--fks | Add foreign keys. Applicable commands: init or runDefault: true |
--histograms | The file to write per-op incremental and cumulative histogram data to. Applicable command: run |
--idle-conns | Tests the TPCC workload with idle connections. |
--init | Deprecated. Use the init command instead.Applicable command: run |
--max-ops | The maximum number of operations to run. Applicable command: run |
--max-rate | The maximum frequency of operations (reads/writes). Applicable command: runDefault: 0, which means unlimited. |
--mix | Weights for the transaction mix. Applicable commands: init or runDefault: newOrder=10,payment=10,orderStatus=1,delivery=1,stockLevel=1, which matches the TPC-C specification. |
--partition-affinity | Run the load generator against a specific partition. This flag must be used in conjunction with --partitions.Applicable commands: init or runDefault: -1 |
--partitions | Partition tables. This flag must be used in conjunction with --split.Applicable commands: init or run |
--ramp | The duration over which to ramp up load. Applicable command: run |
--scatter | Scatter ranges. Applicable commands: init or run |
--seed | The random number generator seed. Applicable commands: init or runDefault: A random seed is used each time the command is run. Reusing a seed is recommended only for reproducing a specific pattern or behavior. Workloads that have a random element should use the default random seed. |
--serializable | Force serializable mode. CockroachDB only supports SERIALIZABLE isolation, so this flag is not necessary.Applicable command: init |
--split | . Applicable commands: init or run |
--tolerate-errors | Keep running on error. Applicable command: run |
--wait | Run in wait mode, i.e., include think/keying sleeps. Applicable commands: init or runDefault: true |
--warehouses | The number of warehouses for loading initial data, at approximately 200 MB per warehouse. Applicable commands: init or runDefault: 1 |
--workers | The number of concurrent workers. Applicable commands: init or runDefault: --warehouses * 10 |
--zones | The number of for partitioning. This number should match the number of --partitions and the zones used to start the cluster.Applicable command: init |
ycsb workload
| Flag | Description |
|---|---|
--concurrency | The number of concurrent workers. Applicable commands: init or runDefault: 8 |
--data-loader | How to load initial table data. Valid options are INSERT and IMPORT.Applicable commands: init or runDefault: INSERT |
--db | The SQL database to use. Applicable commands: init or runDefault: ycsb |
--display-every | The frequency for printing per-operation statistics. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 1s |
--display-format | The format for printing per-operation statistics (simple, incremental-json). When using incremental-json, note that totals are not printed at the end of the workload’s duration.Applicable command: runDefault: simple |
--drop | Drop the existing database, if it exists. Applicable commands: init or run. For the run command, this flag must be used in conjunction with --init. |
--duration | The duration to run, with a required time unit suffix. Valid time units are ns, us, ms, s, m, and h.Applicable command: runDefault: 0, which means run forever. |
--families | Place each column in its own . Applicable commands: init or run |
--histograms | The file to write per-op incremental and cumulative histogram data to. Applicable command: run |
--init | Deprecated. Use the init command instead.Applicable command: run |
--insert-count | Number of rows to sequentially insert before beginning random number generation. Applicable commands: init or runDefault: 10000 |
--json | Use JSONB rather than relational data. Applicable commands: init or run |
--max-ops | The maximum number of operations to run. Applicable command: run |
--max-rate | The maximum frequency of operations (reads/writes). Applicable command: runDefault: 0, which means unlimited. |
--method | The SQL issue method (prepare, noprepare, simple).Applicable commands: init or runDefault: prepare |
--ramp | The duration over which to ramp up load. Applicable command: run |
--request-distribution | Distribution for the random number generator (zipfian, uniform).Applicable commands: init or run.Default: zipfian |
--seed | The random number generator seed. Applicable commands: init or runDefault: A random seed is used each time the command is run. Reusing a seed is recommended only for reproducing a specific pattern or behavior. Workloads that have a random element should use the default random seed. |
--splits | Number of to perform before starting normal operations. Applicable commands: init or run |
--tolerate-errors | Keep running on error. Applicable command: run |
--workload | The type of workload to run (A, B, C, D, or F). For details about these workloads, see YCSB Workloads.Applicable commands: init or runDefault: B |
Logging
By default, thecockroach workload command logs messages to stderr. This includes events with INFO and higher.
If you need to troubleshoot this command’s behavior, you can .
Examples
These examples assume that you have already :Run the bank workload
-
Load the initial schema:
-
Run the workload for 1 minute:
You’ll see per-operation statistics print to standard output every second:After the specified duration (1 minute in this case), the workload will stop and you’ll see totals printed to standard output:
Run the kv workload
-
Load the initial schema:
-
Run the workload for 1 minute:
You’ll see per-operation statistics print to standard output every second:After the specified duration (1 minute in this case), the workload will stop and you’ll see totals printed to standard output:
Load the intro dataset
-
Load the dataset:
-
Launch the built-in SQL client to view it:
Load the startrek dataset
-
Load the dataset:
-
Launch the built-in SQL client to view it:
Load the movr dataset
-
Load the dataset:
-
Launch the built-in SQL client to view it:
Run the movr workload
-
Load the initial schema:
-
Initialize and run the workload for 1 minute:
You’ll see per-operation statistics print to standard output every second:After the specified duration (1 minute in this case), the workload will stop and you’ll see totals printed to standard output:
Run the tpcc workload
-
Load the initial schema and data:
-
Run the workload for 10 minutes:
You’ll see per-operation statistics print to standard output every second:After the specified duration (10 minutes in this case), the workload will stop and you’ll see totals printed to standard output:
Run the ycsb workload
-
Load the initial schema and data:
-
Run the workload for 10 minutes:
You’ll see per-operation statistics print to standard output every second:After the specified duration (10 minutes in this case), the workload will stop and you’ll see totals printed to standard output:
Customize the frequency and format of per-operation statistics
To customize the frequency of per-operation statistics, use the--display-every flag, with ns, us, ms, s, m, and h as valid time units. To customize the format of per-operation statistics, use the --display-format flag, with incremental-json or simple (default) as options.
-
Load the initial schema and data:
-
Run the workload for 1 minute, printing the output every 5 seconds as JSON:
When using
incremental-json, note that totals are not printed at the end of the workload’s duration.

