Junior — Middle
How is data replication carried out in distributed systems?
sobes.tech AI
Answer from AI
Data replication in distributed systems is the process of copying and maintaining up-to-date copies of data on multiple nodes to improve availability and fault tolerance.
Main approaches:
- Synchronous replication: data is written simultaneously to all replicas. Ensures consistency but may reduce performance due to delays.
- Asynchronous replication: data is first written to the primary node, then copied to replicas with delay. Improves performance but may have temporary inconsistency.
The process typically involves:
- Designating a master node that accepts writes.
- Propagating changes to secondary nodes.
- Confirming successful replication.
- Handling conflicts and recovery after failures.
In Go, channels and goroutines are often used for asynchronous data transfer between nodes.