Synchronous vs Asynchronous Replication Interview Questions
Master Synchronous vs Asynchronous Replication with interview-focused questions covering consistency, latency, durability, replication lag, semi-synchronous replication, CAP theorem tradeoffs, failover, production scenarios, and enterprise best practices.
Introduction
Modern distributed databases must balance three important requirements:
- Data Consistency
- Performance
- High Availability
Replication ensures multiple copies of data exist across servers, but the way replicas receive updates determines system behavior.
The two primary replication models are
- Synchronous Replication
- Asynchronous Replication
Many enterprise databases also support
- Semi-Synchronous Replication
Examples include
- PostgreSQL
- MySQL
- Oracle
- SQL Server
- MongoDB
- Redis
- Cassandra
Understanding these replication models is one of the most frequently asked database interview topics.
Replication Models
flowchart TD
Replication --> Synchronous
Replication --> Asynchronous
Replication --> Semi-Synchronous
1. What is Synchronous Replication?
Answer
In Synchronous Replication,
the Primary waits until one or more replicas confirm that they have received (or committed, depending on the database configuration) the transaction before returning success to the client.
Workflow
Application
↓
Primary
↓
Replica Confirmation
↓
Commit
↓
Client Response
Synchronous Replication
flowchart LR
Application --> Primary
Primary --> Replica
Replica --> Acknowledgment
Acknowledgment --> Primary
Primary --> Application
2. What is Asynchronous Replication?
In Asynchronous Replication,
the Primary commits the transaction immediately.
Replication happens later in the background.
Workflow
Application
↓
Primary
↓
Commit
↓
Client Response
↓
Replica Updated Later
Asynchronous Replication
flowchart LR
Application --> Primary
Primary --> ClientResponse["Client Response"]
Primary --> Replica
Replica --> UpdateLater["Update Later"]
3. Why is replication needed?
Replication provides
- High Availability
- Disaster Recovery
- Read Scaling
- Fault Tolerance
- Backup Support
4. What is the major difference?
| Synchronous | Asynchronous |
|---|---|
| Waits for Replica | Does Not Wait |
| Higher Consistency | Higher Performance |
| Higher Latency | Lower Latency |
| Minimal Data Loss | Possible Data Loss |
5. How does Synchronous Replication work?
Steps
Write Request
↓
Primary
↓
Replica Receives
↓
Acknowledgment
↓
Commit
↓
Success Response
6. How does Asynchronous Replication work?
Steps
Write Request
↓
Primary
↓
Commit
↓
Client Response
↓
Background Replication
7. Which replication is faster?
Asynchronous Replication
because
the Primary does not wait
for replicas.
8. Which replication provides stronger consistency?
Synchronous Replication
because
the client receives success
only after replica acknowledgment.
9. What is Replication Lag?
Replication Lag is the delay between
Primary
and
Replica.
Mostly associated with
Asynchronous Replication.
Replication Lag
flowchart LR
Primary --> Transaction --> Delay --> Replica
10. Why does Replication Lag occur?
Reasons include
- Slow Network
- Heavy Write Load
- Large Transactions
- Slow Storage
- Busy Replica
11. What is Data Durability?
Durability means
committed data
survives failures.
Synchronous Replication generally provides stronger durability than asynchronous replication, though the exact guarantees depend on the database implementation and acknowledgment settings.
12. What happens if the Primary crashes?
Synchronous
Replica already has the data.
Little or no committed data is lost (depending on the implementation).
Asynchronous
Recent transactions may not have reached the replica.
Some committed transactions may be lost after failover.
Failure Scenario
flowchart LR
PrimaryCrash["Primary Crash"] --> SynchronousReplicahasdatareplicaHasData["Synchronous --> ReplicaHasData["Replica Has Data"]"]
PrimaryCrash["Primary Crash"] --> AsynchronousPossibledatalosspossibleDataLoss["Asynchronous --> PossibleDataLoss["Possible Data Loss"]"]
13. Which replication has lower latency?
Asynchronous Replication
because
it returns immediately.
14. Which replication has higher latency?
Synchronous Replication
because
it waits
for replica acknowledgment.
15. What is Semi-Synchronous Replication?
Semi-Synchronous Replication
waits for acknowledgment
from at least one replica
before confirming the transaction.
It provides a balance between
- Performance
- Durability
Semi-Synchronous Workflow
flowchart LR
Primary --> Replica1["Replica 1"]
Primary --> Replica2["Replica 2"]
Replica1["Replica 1"] --> Acknowledgment
Acknowledgment --> Commit
16. Which databases support Semi-Synchronous Replication?
Examples
- MySQL
- Some enterprise database solutions
- Various clustered database products
17. Which replication is used in banking?
Usually
Synchronous Replication
because
data consistency
is more important
than latency.
18. Which replication is used in social media?
Usually
Asynchronous Replication
because
high performance
is more important
than immediate consistency.
19. Which replication is used in analytics?
Typically
Asynchronous Replication
because
small delays
are acceptable.
20. What is Eventual Consistency?
In Asynchronous Replication,
replicas eventually receive updates.
For a short period,
different replicas may return different values.
Eventually,
all replicas converge to the same state.
Eventual Consistency
Primary Updated
↓
Replica Delay
↓
Replica Updated
↓
Consistent Again
21. What is Strong Consistency?
Strong Consistency means
every successful write
is immediately visible
according to the guarantees provided by the replication configuration.
Usually achieved using
Synchronous Replication.
22. CAP Theorem and Replication
Distributed systems balance
- Consistency
- Availability
- Partition Tolerance
Generally
- Synchronous Replication favors stronger consistency.
- Asynchronous Replication often favors availability and lower latency.
23. Banking Example
Money Transfer
↓
Primary
↓
Replica Confirmation
↓
Transaction Complete
24. E-Commerce Example
Order Placement
↓
Primary
↓
Async Replica
↓
Order History Updated Later
25. Stock Trading Example
Trade Execution
↓
Synchronous Replication
↓
Avoid Lost Trades
26. Social Media Example
Like Button
↓
Primary
↓
Async Replica
↓
Millions of Updates
27. Global SaaS Example
US Region
↓
Primary
↓
Europe Replica
↓
Asynchronous Replication
↓
Lower Latency
28. Common Problems
Synchronous
- Higher Latency
- Slower Writes
- Network Dependency
Asynchronous
- Replication Lag
- Eventual Consistency
- Possible Data Loss
29. Synchronous vs Asynchronous
| Feature | Synchronous | Asynchronous |
|---|---|---|
| Performance | Lower | Higher |
| Latency | Higher | Lower |
| Data Loss Risk | Minimal | Possible |
| Replication Lag | Very Low | Possible |
| Consistency | Stronger | Eventual |
| Availability During Network Issues | Lower | Higher |
| Banking | Preferred | Rare |
| Analytics | Less Common | Preferred |
30. Which replication should you choose?
Choose Synchronous when
- Banking
- Financial Systems
- Payment Systems
- Inventory Systems
- Critical Transactions
Choose Asynchronous when
- Social Media
- Analytics
- Reporting
- Caching
- Read Replicas
- Content Delivery
Choose Semi-Synchronous when
- Balanced durability and performance are required.
Comparison Architecture
flowchart LR
Synchronous --> StrongConsistency["Strong Consistency"]
Synchronous --> HigherLatency["Higher Latency"]
Asynchronous --> LowerLatency["Lower Latency"]
Asynchronous --> EventualConsistency["Eventual Consistency"]
Enterprise Best Practices
- Choose replication based on business requirements.
- Use Synchronous Replication for critical financial data.
- Use Asynchronous Replication for read-heavy workloads.
- Monitor replication lag continuously.
- Test failover procedures regularly.
- Use Semi-Synchronous Replication when appropriate.
- Keep reliable network connectivity between replicas.
- Monitor replication health.
- Benchmark latency before production deployment.
- Maintain regular backups regardless of replication mode.
Quick Revision
| Topic | Key Point |
|---|---|
| Synchronous | Waits for Replica |
| Asynchronous | Background Replication |
| Semi-Synchronous | Waits for One Replica |
| Replication Lag | Replica Delay |
| Strong Consistency | Immediate Replica Confirmation |
| Eventual Consistency | Replica Updates Later |
| Performance | Asynchronous Better |
| Durability | Synchronous Better |
| Banking | Synchronous |
| Social Media | Asynchronous |
Interview Tips
Interviewers frequently ask
- What is Synchronous Replication?
- What is Asynchronous Replication?
- Which one is faster?
- Which one is more consistent?
- What is Replication Lag?
- What is Eventual Consistency?
- What is Strong Consistency?
- Explain Semi-Synchronous Replication.
- Which replication is used in banking?
- Which replication would you recommend for a global social media platform?
A strong interview explanation is:
"Synchronous Replication waits for replica acknowledgment before confirming a transaction, providing stronger consistency and durability at the cost of higher latency. Asynchronous Replication commits immediately and replicates changes in the background, offering better performance and availability but allowing temporary replication lag and possible data loss during failures. Semi-Synchronous Replication provides a compromise by waiting for acknowledgment from at least one replica before completing the transaction."
Summary
Synchronous and Asynchronous Replication represent two different trade-offs between consistency, performance, and availability. Synchronous Replication is ideal for mission-critical systems requiring strong consistency, while Asynchronous Replication is better suited for high-throughput applications where small replication delays are acceptable. Semi-Synchronous Replication offers a practical balance between durability and performance.
Understanding replication models, consistency guarantees, replication lag, durability, and production use cases is essential for Backend Developers, Database Engineers, DevOps Engineers, Cloud Architects, and Solution Architects designing distributed database systems.