Skip to content

Benchmarking RocksDB

Nikhil Benesch edited this page Jun 14, 2018 · 5 revisions

To benchmark RocksDB outside of CockroachDB, use upstream's db_bench tool.

To build it, run:

$ git clone https://github.com/facebook/rocksdb.git
$ cd rocksdb
$ make -jNCPUS db_bench DEBUG_LEVEL=0

To create a database with 1000 range tombstones, for example:

$ ./db_bench -benchmarks=fillrandom -write_buffer_size=67108864 -level0_file_num_compaction_trigger=4 -max_background_compactions=32 -level0_slowdown_writes_trigger=8 -level0_stop_writes_trigger=12 -num_levels=4 -min_level_to_compress=2 -compression_type=zlib -compression_ratio=0.5 -block_size=16384 -open_files=10000 -target_file_size_base=1048576 -max_bytes_for_level_base=268435456 -writes_per_range_tombstone=50000 -range_tombstone_width=50000 -max_num_range_tombstones=1000 -num=50000000

It's not clear how many of these options are actually required, but they were lifted wholesale from an upstream PR with benchmarking instructions.

You can then run benchmarks against the generated database:

./db_bench -benchmarks=readrandom -readonly -use_existing_db=true -open_files=10000 -num=50000000 -reads=1000000 -cache_size=1073741824 -threads=32