Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion cmd/swarmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func init() {
mainCmd.Flags().String("generic-node-resources", "", "user defined resources (e.g. fpga=2,gpu=UUID1,gpu=UUID2,gpu=UUID3)")
mainCmd.Flags().Bool("force-new-cluster", false, "Force the creation of a new cluster from data directory")
mainCmd.Flags().Uint32("heartbeat-tick", 1, "Defines the heartbeat interval (in seconds) for raft member health-check")
mainCmd.Flags().Uint32("election-tick", 3, "Defines the amount of ticks (in seconds) needed without a Leader to trigger a new election")
mainCmd.Flags().Uint32("election-tick", 10, "Defines the amount of ticks (in seconds) needed without a Leader to trigger a new election")
mainCmd.Flags().Var(&externalCAOpt, "external-ca", "Specifications of one or more certificate signing endpoints")
mainCmd.Flags().Bool("autolock", false, "Require an unlock key in order to start a manager once it's been stopped")
mainCmd.Flags().String("unlock-key", "", "Unlock this manager using this key")
Expand Down
14 changes: 10 additions & 4 deletions manager/state/raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,11 @@ func (n *Node) joinCluster(ctx context.Context) error {
// raft node that can be modified and customized
func DefaultNodeConfig() *raft.Config {
return &raft.Config{
HeartbeatTick: 1,
ElectionTick: 3,
HeartbeatTick: 1,
// Recommended value in etcd/raft is 10 x (HeartbeatTick).
Copy link
Copy Markdown
Contributor

@nishanttotla nishanttotla Mar 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add more of a description around why? It would certainly be useful to at least add that historically lower values have potentially caused frequent leader elections.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

// Lower values were seen to have caused instability because of
// frequent leader elections when running on flakey networks.
ElectionTick: 10,
MaxSizePerMsg: math.MaxUint16,
MaxInflightMsgs: 256,
Logger: log.L,
Expand All @@ -489,8 +492,11 @@ func DefaultRaftConfig() api.RaftConfig {
KeepOldSnapshots: 0,
SnapshotInterval: 10000,
LogEntriesForSlowFollowers: 500,
ElectionTick: 3,
HeartbeatTick: 1,
// Recommended value in etcd/raft is 10 x (HeartbeatTick).
// Lower values were seen to have caused instability because of
// frequent leader elections when running on flakey networks.
HeartbeatTick: 1,
ElectionTick: 10,
}
}

Expand Down