From 053a7f2fa2080c7dbc781345face2602e0f31f7b Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Mon, 21 Jun 2021 12:00:41 -0700 Subject: [PATCH] raft: Set BatchApplyCh for more consistent batch sizes (#11907) * raft: Set BatchApplyCh for more consistent batch sizes * Add changelog file --- changelog/11907.txt | 3 +++ physical/raft/raft.go | 5 +++++ 2 files changed, 8 insertions(+) create mode 100644 changelog/11907.txt diff --git a/changelog/11907.txt b/changelog/11907.txt new file mode 100644 index 0000000000000..e2bbafe95e16f --- /dev/null +++ b/changelog/11907.txt @@ -0,0 +1,3 @@ +```release-note:improvement +raft: Improve raft batch size selection +``` diff --git a/physical/raft/raft.go b/physical/raft/raft.go index 6ca75043f3455..06b32220e67ce 100644 --- a/physical/raft/raft.go +++ b/physical/raft/raft.go @@ -671,6 +671,11 @@ func (b *RaftBackend) applyConfigSettings(config *raft.Config) error { config.NoSnapshotRestoreOnStart = true config.MaxAppendEntries = 64 + // Setting BatchApplyCh allows the raft library to enqueue up to + // MaxAppendEntries into each raft apply rather than relying on the + // scheduler. + config.BatchApplyCh = true + return nil }