From aafe7bd3760f58a60a010984492377c30e9b0b14 Mon Sep 17 00:00:00 2001 From: anand76 Date: Fri, 4 Nov 2022 11:01:33 -0700 Subject: [PATCH] Add multireadwhilewriting benchmark to db_bench (#10919) Summary: Add the new benchmark Pull Request resolved: https://github.com/facebook/rocksdb/pull/10919 Reviewed By: akankshamahajan15 Differential Revision: D41017025 Pulled By: anand1976 fbshipit-source-id: 5220815d66de1f689b7f09d9c5266cebf4e345d1 --- tools/db_bench_tool.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 062554632..314a77809 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -3498,6 +3498,11 @@ class Benchmark { fprintf(stderr, "entries_per_batch = %" PRIi64 "\n", entries_per_batch_); method = &Benchmark::MultiReadRandom; + } else if (name == "multireadwhilewriting") { + fprintf(stderr, "entries_per_batch = %" PRIi64 "\n", + entries_per_batch_); + num_threads++; + method = &Benchmark::MultiReadWhileWriting; } else if (name == "approximatesizerandom") { fprintf(stderr, "entries_per_batch = %" PRIi64 "\n", entries_per_batch_); @@ -6895,6 +6900,14 @@ class Benchmark { } } + void MultiReadWhileWriting(ThreadState* thread) { + if (thread->tid > 0) { + MultiReadRandom(thread); + } else { + BGWriter(thread, kWrite); + } + } + void ReadWhileMerging(ThreadState* thread) { if (thread->tid > 0) { ReadRandom(thread);