How to test range query performance using db_bench of rocksdb?

81 views Asked by At

I want to test the range query performance of rocksdb by using rocksdb's db_bench, but I don't know how to config, and I can't find any method on Google. Can you help me? Thank you!

There are many benchmark args of rocksdb's db_bench, such as 'readrandom' and 'seekrandom', and I don't know which arg supports range query.

2

There are 2 answers

1
Ayaan Haider On

To test the range query performance of RocksDB using db_bench, you'll want to focus on arguments that allow you to perform range scans. Typically, in db_bench, the readwhilescanning argument is used for this purpose.

Here's a brief guide on how to configure it:

Specify the Benchmark: Use --benchmarks=readwhilescanning. This benchmark performs range queries.

Set Up the Database: Before running the benchmark, ensure your database has enough data to test the range queries effectively.

Customize Parameters: You can adjust various parameters like the number of queries, the size of the database, etc., to suit your test requirements.

Run db_bench: Execute the db_bench command with the specified arguments.

Example Command:

./db_bench --benchmarks=readwhilescanning --num=100000 --reads=1000 --value_size=1024 --histogram=1 --db=path/to/db

This command runs the readwhilescanning benchmark on a database located at path/to/db, with 100,000 keys, performing 1,000 read operations, and values of size 1024 bytes.

1
ajkr On

In db_bench the benchmark is called "seekrandom". There are different options for specifying what kind of scan is done after each Seek(). The most basic one is -seek_nexts to call Next() the specified number of times. (This question is duplicated on GitHub: https://github.com/facebook/rocksdb/issues/12195)