Data replication is the process of copying and maintaining database or data storage copies across multiple servers or locations to improve availability, fault tolerance, and performance.
Click to reveal answer
intermediate
Explain the difference between synchronous and asynchronous replication.
Synchronous replication waits for data to be copied to all replicas before confirming success, ensuring consistency but adding latency. Asynchronous replication confirms success immediately and copies data later, improving speed but risking temporary inconsistency.
Click to reveal answer
beginner
What is master-slave replication?
Master-slave replication means one server (master) handles writes and updates, while one or more servers (slaves) copy data from the master and serve read requests, improving read scalability.
Click to reveal answer
advanced
Describe multi-master replication and its main challenge.
Multi-master replication allows multiple servers to accept writes and replicate changes to each other. The main challenge is conflict resolution when the same data is changed on different masters simultaneously.
Click to reveal answer
intermediate
What is eventual consistency in replication?
Eventual consistency means that replicas may temporarily differ but will become consistent over time once all updates propagate, trading immediate consistency for better availability and performance.
Click to reveal answer
Which replication strategy waits for all replicas to confirm before completing a write?
AEventual consistency
BAsynchronous replication
CMaster-slave replication
DSynchronous replication
✗ Incorrect
Synchronous replication waits for all replicas to confirm the write to ensure consistency.
In master-slave replication, which server handles write operations?
AMaster
BSlave
CBoth master and slave
DNone
✗ Incorrect
The master server handles all write operations; slaves replicate data and serve reads.
What is a key challenge of multi-master replication?
AScaling reads
BData backup
CConflict resolution
DLatency reduction
✗ Incorrect
Multi-master replication must handle conflicts when multiple masters update the same data.
Which replication type offers lower latency but may cause temporary inconsistency?
Eventual consistency means replicas will match after some time, not instantly.
Explain the main differences between synchronous and asynchronous data replication.
Think about when the system confirms a write is successful.
You got /3 concepts.
Describe master-slave and multi-master replication strategies and their use cases.
Consider read/write patterns and conflict handling.
You got /3 concepts.
Practice
(1/5)
1. Which data replication strategy ensures that all copies of data are updated at the same time before confirming a write operation?
easy
A. Synchronous replication
B. Asynchronous replication
C. Master-slave replication
D. Multi-master replication
Solution
Step 1: Understand synchronous replication
Synchronous replication waits for all copies to confirm the write before completing the operation.
Step 2: Compare with other strategies
Asynchronous replication does not wait, master-slave and multi-master describe topology, not timing.
Final Answer:
Synchronous replication -> Option A
Quick Check:
Strong consistency = Synchronous replication [OK]
Hint: Strong consistency means waiting for all copies to update [OK]
Common Mistakes:
Confusing asynchronous with synchronous replication
Mixing replication timing with replication topology
Assuming master-slave means synchronous
2. Which of the following is the correct description of asynchronous replication?
easy
A. Replicas confirm the data before the primary confirms the write
B. Data is copied to replicas without waiting for confirmation from them
C. Data is copied simultaneously to all replicas with confirmation
D. Data is copied to replicas before the primary confirms the write
Solution
Step 1: Define asynchronous replication
It copies data to replicas but does not wait for their confirmation before confirming the write.
Step 2: Eliminate other options
Replicas confirm the data before the primary confirms the write requires replica confirmation before primary ack (synchronous); B copies before primary ack (incorrect); C describes synchronous behavior.
Final Answer:
Data is copied to replicas without waiting for confirmation from them -> Option B
Quick Check:
Asynchronous = no wait for replica confirmation [OK]
Hint: Asynchronous means no waiting for replicas to confirm [OK]
Common Mistakes:
Thinking asynchronous waits for replicas
Confusing timing of data copy
Mixing synchronous and asynchronous definitions
3. Consider a system using master-slave replication. If the master receives a write request, what happens next?
medium
A. The write is applied simultaneously to master and slaves synchronously
B. The write is applied to all slaves first, then to the master
C. The write is only applied to slaves, not the master
D. The write is applied to the master and then asynchronously copied to slaves
Solution
Step 1: Understand master-slave replication flow
Writes go to the master first, then are copied to slaves, usually asynchronously.
Step 2: Check other options
Slaves do not receive writes first or alone; synchronous writes to all are not typical in master-slave.
Final Answer:
The write is applied to the master and then asynchronously copied to slaves -> Option D
Quick Check:
Master handles writes first in master-slave [OK]
Hint: Master handles writes first, slaves get updates later [OK]
Common Mistakes:
Assuming slaves can accept writes first
Confusing synchronous with asynchronous replication
Thinking slaves are independent masters
4. A system using multi-master replication faces conflicts when two masters update the same data simultaneously. What is a common way to fix this issue?
medium
A. Switch to asynchronous replication only
B. Disable writes on all but one master
C. Use conflict resolution strategies like timestamps or version vectors
D. Remove all replicas and use a single database
Solution
Step 1: Identify conflict in multi-master replication
Simultaneous writes cause conflicts that need resolution strategies.
Step 2: Evaluate conflict resolution methods
Timestamps or version vectors help decide which write wins or how to merge.
Final Answer:
Use conflict resolution strategies like timestamps or version vectors -> Option C