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:
- Connects to a running cluster.
- Creates the schema (or skips if
--init=false). - Starts N goroutines doing random ops at a target rate.
- Reports per-second p50/p95/p99 latency and throughput.
Related pages
- Apps / workload — the binary.
- Apps / roachtest — workloads run as part of nightly stress.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.