Skip to content

Instantly share code, notes, and snippets.

@royki
Created January 12, 2021 00:05
Show Gist options
  • Save royki/aec7dcec9d7f7101f1a00bd3a240be70 to your computer and use it in GitHub Desktop.
Save royki/aec7dcec9d7f7101f1a00bd3a240be70 to your computer and use it in GitHub Desktop.
Consensus Algorithm
- Consensus Algoriithm must have -
- Agreement -> Where every correct process must agree on the same value.
- Validity -> The value agreed on must have been proposed by another process.
- Termination -> A value will eventually be decided by every correct process.
- CAP Theorem -> An algorithm cannot provide more than of the three following properties -
- Consistency
- Availability
- Partition Tolerance
- There are different types of failure that a consensus algorithm might have to deal with fail.
- Fail-stop
- Network partition
- Fail-recover
- Byzantine failure
- *Raft* -> Replicated & Fault Tolerant.
- Raft doesn't use `Time`, it uses `Terms` instead.
- Terms is an integer that starts at zero and increments by one every time an election is held. Each term starts with an election. The time
for the leader election should be shot fraction of the entire term.
- Node in the cluster can be in one of the three states
- Follower
- Candidate
- Leader
- All of the nodes in the cluster status identical followers that all have the potential to become a leader.
- Each follower has a random election time out.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment