A database administrator is setting up a high availability solution for a read-heavy application. The goal is to distribute read queries across multiple database instances to improve performance and provide fault tolerance for read operations, without impacting write performance on the primary. Which replication strategy is most suitable for this scenario?
- ADatabase Mirroring (synchronous)
- BSynchronous Replication
- CTwo-Phase Commit
- DMaster-Slave Replication
Show answer & explanationAnswer & explanation
Correct answer: D. Master-Slave Replication
Master-Slave replication (often referred to as primary-replica or primary-secondary) is ideal for read-heavy workloads. The primary (master) handles all write operations, and changes are replicated to one or more secondary (slave) instances, which can then serve read queries, distributing the load and improving read performance without affecting the primary's write capabilities.
Why the other options are wrong
- A. Synchronous database mirroring aims for high availability with zero data loss for the entire database, not specifically for distributing read loads and can impact primary write performance due to commit latency.
- B. Synchronous replication focuses on ensuring data consistency across replicas for disaster recovery or high availability, not primarily for read scaling, and can impact write performance.
- C. Two-Phase Commit is a distributed transaction protocol to ensure atomicity across multiple nodes, not a replication strategy for read scaling.
Master-Slave Replication
Master-Slave replication is a database architecture where one database server (master) acts as the authoritative source for data, handling all write operations, while one or more other database servers (slaves) receive copies of the data and primarily serve read queries.
- Master handles all writes; slaves handle reads.
- Improves read scalability and performance.
- Provides fault tolerance for read operations.
Memory trick: Master writes, slaves read, a balanced workload, indeed.