md • Lines: 14# Techniques to achieve reliability
## Write Ahead Log
Write a line of log with operations to be performed before actually performing. If the machine crashes in between, then it can restore from last state. Databases use it. Also good for replication.
For example, Alice transfers Bob 500 rupees.
Operations: Read Alice Balance, Read Bob balance, update alice balance, update bob balance.
If there is a failure in between, node can restart from log on the state before failure.
Tools it uses: CRC
## Leader Follower
If multiple nodes perform conflicting updates, instead of letting them perform, we let the leader take the control.
## Leader Election
When a leader fails before replicating to some servers. The followers are now in charge of replicating the data between themselves. The one with the latest entry will share the state and replicate them among themselves.
If a log entry is replicated among the majority of the nodes, then it is marked as a complete. majority quorum.