From 771b9479b0625a1c3bb87b763326fc9e219c1725 Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Mon, 21 Jun 2021 10:15:36 -0700 Subject: [PATCH 1/2] raft: Set BatchApplyCh for more consistent batch sizes --- physical/raft/raft.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/physical/raft/raft.go b/physical/raft/raft.go index f7065ef7831de..a4a0c53976ef9 100644 --- a/physical/raft/raft.go +++ b/physical/raft/raft.go @@ -663,6 +663,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 } From 85303558b6595a73730827cdcbe564f118dce0f1 Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Mon, 21 Jun 2021 10:55:26 -0700 Subject: [PATCH 2/2] Add changelog file --- changelog/11907.txt | 3 +++ 1 file changed, 3 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 +```