mirror of https://github.com/facebook/rocksdb.git
Avoid seed reuse when --benchmarks has more than one test (#9733)
Summary: When --benchmarks has more than one test then the threads in one benchmark will use the same set of seeds as the threads in the previous benchmark. This diff fixe that. This fixes https://github.com/facebook/rocksdb/issues/9632 Pull Request resolved: https://github.com/facebook/rocksdb/pull/9733 Test Plan: For this command line the block cache is 8GB, so it caches at most 1024 8KB blocks. Note that without this diff the second run of readrandom has a much better response time because seed reuse means the second run reads the same 1000 blocks as the first run and they are cached at that point. But with this diff that does not happen. ./db_bench --benchmarks=fillseq,flush,compact0,waitforcompaction,levelstats,readrandom,readrandom --compression_type=zlib --num=10000000 --reads=1000 --block_size=8192 ... ``` Level Files Size(MB) -------------------- 0 0 0 1 11 238 2 9 253 3 0 0 4 0 0 5 0 0 6 0 0 ``` --- perf results without this diff DB path: [/tmp/rocksdbtest-2260/dbbench] readrandom : 46.212 micros/op 21618 ops/sec; 2.4 MB/s (1000 of 1000 found) DB path: [/tmp/rocksdbtest-2260/dbbench] readrandom : 21.963 micros/op 45450 ops/sec; 5.0 MB/s (1000 of 1000 found) --- perf results with this diff DB path: [/tmp/rocksdbtest-2260/dbbench] readrandom : 47.213 micros/op 21126 ops/sec; 2.3 MB/s (1000 of 1000 found) DB path: [/tmp/rocksdbtest-2260/dbbench] readrandom : 42.880 micros/op 23299 ops/sec; 2.6 MB/s (1000 of 1000 found) Reviewed By: jay-zhuang Differential Revision: D35089763 Pulled By: mdcallag fbshipit-source-id: 1b50143a07afe876b8c8e5fa50dd94a8ce57fc6b
This commit is contained in:
parent
727d11ceb4
commit
d583d23d86
|
@ -2474,6 +2474,7 @@ class Benchmark {
|
|||
int key_size_;
|
||||
int user_timestamp_size_;
|
||||
int prefix_size_;
|
||||
int total_thread_count_;
|
||||
int64_t keys_per_prefix_;
|
||||
int64_t entries_per_batch_;
|
||||
int64_t writes_before_delete_range_;
|
||||
|
@ -2872,6 +2873,7 @@ class Benchmark {
|
|||
key_size_(FLAGS_key_size),
|
||||
user_timestamp_size_(FLAGS_user_timestamp_size),
|
||||
prefix_size_(FLAGS_prefix_size),
|
||||
total_thread_count_(0),
|
||||
keys_per_prefix_(FLAGS_keys_per_prefix),
|
||||
entries_per_batch_(1),
|
||||
reads_(FLAGS_reads < 0 ? FLAGS_num : FLAGS_reads),
|
||||
|
@ -3655,7 +3657,8 @@ class Benchmark {
|
|||
arg[i].bm = this;
|
||||
arg[i].method = method;
|
||||
arg[i].shared = &shared;
|
||||
arg[i].thread = new ThreadState(i);
|
||||
total_thread_count_++;
|
||||
arg[i].thread = new ThreadState(total_thread_count_);
|
||||
arg[i].thread->stats.SetReporterAgent(reporter_agent.get());
|
||||
arg[i].thread->shared = &shared;
|
||||
FLAGS_env->StartThread(ThreadBody, &arg[i]);
|
||||
|
|
Loading…
Reference in New Issue