Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease tick interval to 50 ms. #1191

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions worker/draft.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ func newNode(gid uint32, id uint64, myAddr string) *node {
gid: gid,
store: store,
cfg: &raft.Config{
ID: id,
ElectionTick: 10,
ID: id,
// 500 ms if we call Tick() every 50 ms.
ElectionTick: 10,
// 50 ms if we call Tick() every 50 ms.
HeartbeatTick: 1,
Storage: store,
MaxSizePerMsg: 4096,
Expand Down Expand Up @@ -708,7 +710,10 @@ func (n *node) retrieveSnapshot(peerID uint64) {
func (n *node) Run() {
firstRun := true
var leader bool
ticker := time.NewTicker(time.Second)
// See also our configuration of HeartbeatTick and ElectionTick. For whatever reason, when
// bring up a node we can only replay one raft index entry every tick. It would be nice to
// figure out why.
ticker := time.NewTicker(50 * time.Millisecond)
defer ticker.Stop()
rcBytes, err := n.raftContext.Marshal()
x.Check(err)
Expand Down