Serialized Form
-
Package io.microraft
-
Class io.microraft.RaftConfig
class RaftConfig extends Object implements Serializable-
Serialized Fields
-
appendEntriesRequestBatchSize
int appendEntriesRequestBatchSize
In MicroRaft, a leader Raft node sends log entries to its followers in batches to improve the throughput. This configuration parameter specifies the maximum number of Raft log entries that can be sent as a batch in a single append entries request. -
commitCountToTakeSnapshot
int commitCountToTakeSnapshot
Number of new commits to initiate a new snapshot after the last snapshot taken by a Raft node. This value must be configured wisely as it effects performance of the system in multiple ways. If a small value is set, it means that snapshots are taken too frequently and Raft nodes keep a very short Raft log. If snapshot objects are large and the Raft state is persisted to disk, this can create an unnecessary overhead on IO performance. Moreover, a Raft leader can send too many snapshots to slow followers which can create a network overhead. On the other hand, if a very large value is set, it can create a memory overhead since Raft log entries are going to be kept in memory until the next snapshot. -
leaderElectionTimeoutMillis
long leaderElectionTimeoutMillis
Duration of leader election rounds in milliseconds. If a candidate cannot win majority votes before this timeout elapses, a new leader election round is started. See "Section 5.2: Leader Election" in the Raft paper. -
leaderHeartbeatPeriodSecs
long leaderHeartbeatPeriodSecs
Duration in seconds for a Raft leader node to send periodic heartbeat requests to its followers in order to denote its liveliness. Periodic heartbeat requests are actually append entries requests and can contain log entries. A periodic heartbeat request is not sent to a follower if an append entries request has been sent to that follower recently. -
leaderHeartbeatTimeoutSecs
long leaderHeartbeatTimeoutSecs
Duration in seconds for a follower to decide on failure of the current leader and start a new leader election round. If this duration is too short, a leader could be considered as failed unnecessarily in case of a small hiccup. If it is too long, it takes longer to detect an actual failure.Even though there is a single "election timeout" parameter in the Raft paper for both timing-out a leader election round and detecting failure of the leader, MicroRaft uses two different parameters for these cases.
You can set
RaftConfig.leaderElectionTimeoutMillis
and this field to the same duration to align with the "election timeout" definition in the Raft paper. -
maxPendingLogEntryCount
int maxPendingLogEntryCount
Maximum number of pending log entries in the leader's Raft log before temporarily rejecting new requests of clients. This configuration enables a back pressure mechanism to prevent OOME when a Raft leader cannot keep up with the requests sent by the clients. When the "pending log entries buffer" whose capacity is specified with this configuration field is filled, new requests fail withCannotReplicateException
to slow down the clients. You can configure this field by considering the degree of concurrency of your clients. -
raftNodeReportPublishPeriodSecs
int raftNodeReportPublishPeriodSecs
Denotes how frequently a Raft node publishes a report of its internal Raft state.RaftNodeReport
objects can be used for monitoring a running Raft group. -
transferSnapshotsFromFollowersEnabled
boolean transferSnapshotsFromFollowersEnabled
If enabled, when a Raft follower falls far behind the Raft leader and needs to install a snapshot, it transfers the snapshot chunks from both the Raft leader and other followers in parallel. This is a safe optimization because in MicroRaft snapshots are taken at the same log indices on all Raft nodes.
-
-
-
-
Package io.microraft.exception
-
Exception io.microraft.exception.CannotReplicateException
class CannotReplicateException extends RaftException implements Serializable- serialVersionUID:
- 4407025930140337716L
-
Exception io.microraft.exception.IndeterminateStateException
class IndeterminateStateException extends RaftException implements Serializable- serialVersionUID:
- -736303015926722821L
-
Exception io.microraft.exception.LaggingCommitIndexException
class LaggingCommitIndexException extends RaftException implements Serializable- serialVersionUID:
- -2244714904905721002L
-
Exception io.microraft.exception.MismatchingRaftGroupMembersCommitIndexException
class MismatchingRaftGroupMembersCommitIndexException extends RaftException implements Serializable- serialVersionUID:
- -109570074579015635L
-
Serialized Fields
-
commitIndex
long commitIndex
-
members
Collection<RaftEndpoint> members
-
-
Exception io.microraft.exception.NotLeaderException
class NotLeaderException extends RaftException implements Serializable- serialVersionUID:
- 1817579502149525710L
-
Exception io.microraft.exception.RaftException
class RaftException extends RuntimeException implements Serializable- serialVersionUID:
- 3165333502175586105L
-
Serialized Fields
-
leader
RaftEndpoint leader
-
-
-
Package io.microraft.model