Add async_io read option in db_bench (#9735)

Summary:
Add async_io Read option in db_bench

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9735

Test Plan:
./db_bench -use_existing_db=true
-db=/tmp/prefix_scan_prefetch_main -benchmarks="seekrandom" -key_size=32
-value_size=512 -num=5000000 -use_direct_reads=true -seek_nexts=327680
-duration=120 -ops_between_duration_checks=1 -async_io=1

Reviewed By: riversand963

Differential Revision: D35058482

Pulled By: akankshamahajan15

fbshipit-source-id: 1522b638c79f6d85bb7408c67f6ab76dbabeeee7
This commit is contained in:
Akanksha Mahajan 2022-03-22 17:21:35 -07:00 committed by Facebook GitHub Bot
parent 63a284a6ad
commit f07eec1bf8

View File

@ -1124,6 +1124,10 @@ DEFINE_bool(rate_limit_auto_wal_flush, false,
"false) after the user "
"write operation");
DEFINE_bool(async_io, false,
"When set true, RocksDB does asynchronous reads for internal auto "
"readahead prefetching.");
static enum ROCKSDB_NAMESPACE::CompressionType StringToCompressionType(
const char* ctype) {
assert(ctype);
@ -3120,6 +3124,7 @@ class Benchmark {
read_options_.tailing = FLAGS_use_tailing_iterator;
read_options_.readahead_size = FLAGS_readahead_size;
read_options_.adaptive_readahead = FLAGS_adaptive_readahead;
read_options_.async_io = FLAGS_async_io;
void (Benchmark::*method)(ThreadState*) = nullptr;
void (Benchmark::*post_process_method)() = nullptr;
@ -5402,6 +5407,8 @@ class Benchmark {
}
options.adaptive_readahead = FLAGS_adaptive_readahead;
options.async_io = FLAGS_async_io;
Iterator* iter = db->NewIterator(options);
int64_t i = 0;
int64_t bytes = 0;
@ -7317,6 +7324,7 @@ class Benchmark {
DB* db = SelectDB(thread);
ReadOptions ro;
ro.adaptive_readahead = FLAGS_adaptive_readahead;
ro.async_io = FLAGS_async_io;
ro.rate_limiter_priority =
FLAGS_rate_limit_user_ops ? Env::IO_USER : Env::IO_TOTAL;
ro.readahead_size = FLAGS_readahead_size;
@ -7331,6 +7339,7 @@ class Benchmark {
DB* db = SelectDB(thread);
ReadOptions ro;
ro.adaptive_readahead = FLAGS_adaptive_readahead;
ro.async_io = FLAGS_async_io;
ro.rate_limiter_priority =
FLAGS_rate_limit_user_ops ? Env::IO_USER : Env::IO_TOTAL;
ro.readahead_size = FLAGS_readahead_size;