Skip to content

Commit 3c86fff

Browse files
committed
chore: add pipeline flag
Signed-off-by: Roman Gershman <[email protected]>
1 parent 8973688 commit 3c86fff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/server/dfly_bench.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ABSL_FLAG(uint64_t, seed, 42, "A seed for random data generation");
4141
ABSL_FLAG(uint64_t, key_stddev, 0,
4242
"Standard deviation for non-uniform distribution, 0 chooses"
4343
" a default value of (max-min)/6");
44+
ABSL_FLAG(uint32_t, pipeline, 1, "maximum number of pending requests per connection");
4445
ABSL_FLAG(string, ratio, "1:10", "Set:Get ratio");
4546
ABSL_FLAG(string, command, "", "custom command with __key__ placeholder for keys");
4647
ABSL_FLAG(string, P, "", "protocol can be empty (for RESP) or memcache_text");
@@ -314,7 +315,10 @@ void Driver::Connect(unsigned index, const tcp::endpoint& ep) {
314315

315316
void Driver::Run(uint64_t* cycle_ns, CommandGenerator* cmd_gen) {
316317
const int64_t start = absl::GetCurrentTimeNanos();
318+
unsigned pipeline = GetFlag(FLAGS_pipeline);
319+
317320
stats_.num_clients++;
321+
318322
for (unsigned i = 0; i < num_reqs_; ++i) {
319323
int64_t now = absl::GetCurrentTimeNanos();
320324

@@ -333,7 +337,7 @@ void Driver::Run(uint64_t* cycle_ns, CommandGenerator* cmd_gen) {
333337
// Coordinated omission.
334338

335339
fb2::NoOpLock lk;
336-
cnd_.wait(lk, [this] { return reqs_.empty(); });
340+
cnd_.wait(lk, [this, pipeline] { return reqs_.size() < pipeline; });
337341
}
338342
string cmd = cmd_gen->Next();
339343

0 commit comments

Comments
 (0)