Skip to main content
The cockroach debug pebble db analyze-data samples data blocks from Pebble files in a store directory and runs compression experiments. The command writes results to a CSV file for analysis.
This command reads data files from disk and can generate noticeable disk I/O and CPU load. When running it on a node that is serving production traffic, we recommend throttling read bandwidth using --read-mb-per-sec.

Subcommands

While the cockroach debug command has a few subcommands, users are expected to use only the , , , , , and subcommands. We recommend using the and subcommands only when directed by the . The other debug subcommands are useful only to Cockroach Labs. Output of debug commands may contain sensitive or secret information.

Synopsis

Flags

The debug pebble db analyze-data subcommand supports the following flags.
FlagDescription
--comparerComparer name (use default if empty).
--mergerMerger name (use default if empty).
--outputPath for the output CSV file.
--read-mb-per-secLimits read I/O bandwidth to avoid disrupting running workloads (0 = no limit). Recommended range is between 1 (1 MiB) and 10 (10 MiB). Default:0
--sample-percentPercentage of data to sample before stopping. Default:100
--timeoutStop after this much time has passed (0 = no timeout). Default:0

Details

Use cases

Use this command to collect real-world compression statistics for a ’s data, such as:
  • Estimated compression ratios across supported algorithms and levels.
  • Estimated compression and decompression CPU costs.
This data can help Cockroach Labs evaluate compression defaults and can help you evaluate whether an alternate compression algorithm is appropriate for your workload.

Where to run

  • On a node’s : You can run this command alongside a live CockroachDB node’s process. The command does not communicate with the process, but it can compete for disk bandwidth and CPU.
  • On a representative subset of nodes: For large clusters, you typically do not need to run this command on every node. You can also run it on one node for a period of time, and then on another node.
  • On a backup directory: You can run this command against a backup directory (specified ). This can be much less disruptive than running it on nodes with an active workload.

Output behavior

The output CSV file is periodically rewritten while the command is running. Even if the command is interrupted, you can still use the most recently written output.

Review results with Cockroach Labs

The command groups sampled blocks into buckets (by block type, block size, data compressibility) and reports compression results for each bucket.
  • CR is the compression ratio. Higher values mean that compressed data uses less storage.
  • Comp is compression throughput. Lower throughput means higher CPU cost when Pebble writes or rewrites SSTs.
  • Decomp is decompression throughput. Lower throughput means higher CPU cost when CockroachDB reads compressed data.
  • Snappy, MinLZ1, Zstd1, Auto1/30, Auto1/15, and Zstd3 are compression experiments. These names are not a one-to-one list of valid values for . Use them to compare the general speed and space tradeoffs of lower-effort, adaptive, and higher-effort compression.
These results are intended for review with Cockroach Labs, rather than to direct your own tuning decisions. Before changing SSTable compression settings in production, contact Cockroach Labs Support to understand whether compression tradeoffs are relevant for a representative store. Most users do not need to tune SSTable compression settings. For more information about Pebble SSTable compression, refer to .

Examples

View help output

Analyze a store directory with throttled reads

Limit the amount of data sampling

Stop after a fixed duration

See also