Open-Source Wikis

/

CockroachDB

/

Features

/

Workload generator

cockroachdb/cockroach

Workload generator

pkg/workload/ is a library of synthetic workloads exercising CockroachDB end-to-end. The workload binary (pkg/cmd/workload/) and roachprod-microbench consume it.

What's included

The directory contains 30+ workloads. Notable ones:

Workload Purpose
kv Pure KV puts/gets at a chosen size and skew
tpcc TPC-C benchmark
tpch TPC-H decision-support
ycsb YCSB A–F
movr A relational example used for demos
bank Two-account transfer (race detection)
bulkingest IMPORT-style bulk
schemachange Stress schema changes against a running cluster
randgen Random schema + random queries (catches optimizer bugs)
vecindex Vector-index recall and latency

Architecture

Each workload exposes a CLI command via workloadcmd and implements the workload.Generator interface (pkg/workload/workload.go):

  • Tables() []Table — schema and bulk-load data generators.
  • Ops(...) (QueryLoad, error) — concurrent client operations.
  • Hooks() Hooks — pre- and post-run hooks.

A workload run invocation:

  1. Connects to a running cluster.
  2. Creates the schema (or skips if --init=false).
  3. Starts N goroutines doing random ops at a target rate.
  4. Reports per-second p50/p95/p99 latency and throughput.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Workload generator – CockroachDB wiki | Factory