From 05314fd885eb74c2241a21798588f602c7714f26 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 14 Jun 2016 22:44:20 +0200 Subject: [PATCH] buffer applyCh with up to conf.MaxAppendEntries This change improves throughput in busy Raft clusters. By buffering messages, individual RPCs contain more Raft messages. In my tests, this improves throughput from about 4.5 kqps to about 5.5 kqps. --- raft.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raft.go b/raft.go index e2ade02b1..a2d038719 100644 --- a/raft.go +++ b/raft.go @@ -206,7 +206,7 @@ func NewRaft(conf *Config, fsm FSM, logs LogStore, stable StableStore, snaps Sna // Create Raft struct r := &Raft{ - applyCh: make(chan *logFuture), + applyCh: make(chan *logFuture, conf.MaxAppendEntries), conf: conf, fsm: fsm, fsmCommitCh: make(chan commitTuple, 128),