Skip to main content
CockroachDB comes with built-in load generators for simulating different types of client workloads, printing per-operation statistics and totals after a specific duration or max number of operations. To run one of these load generators, use the 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:
Run a workload:
View help:

Subcommands

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 --concurrency flag 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

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

The cockroach 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:

bank workload

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.

kv workload

movr workload

tpcc workload

ycsb workload

Logging

By default, the cockroach 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

  1. Load the initial schema:
  2. 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

  1. Load the initial schema:
  2. 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

  1. Load the dataset:
  2. Launch the built-in SQL client to view it:

Load the startrek dataset

  1. Load the dataset:
  2. Launch the built-in SQL client to view it:

Load the movr dataset

  1. Load the dataset:
  2. Launch the built-in SQL client to view it:

Run the movr workload

  1. Load the initial schema:
  2. 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

  1. Load the initial schema and data:
  2. 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

  1. Load the initial schema and data:
  2. 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.
  1. Load the initial schema and data:
  2. 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.

See also