Discuss Data Replication Techniques (Primary-Secondary)

System Design
Easy
Oracle
93.1K views

Explain synchronous vs. asynchronous replication for databases. Discuss the trade-offs in terms of read/write latency and data loss risk (RPO/RTO).

Why Interviewers Ask This

Interviewers at Oracle ask this to verify your grasp of distributed database consistency models. They specifically evaluate your ability to balance data durability against system availability and latency. Understanding the trade-offs between synchronous and asynchronous replication demonstrates whether you can design systems that meet specific business RPO and RTO requirements rather than just knowing definitions.

How to Answer This Question

1. Start by defining the Primary-Secondary model clearly, establishing the primary node as the source of truth for writes. 2. Immediately distinguish between Synchronous and Asynchronous replication, explaining how each handles commit acknowledgment. 3. Analyze the trade-offs: explain that synchronous replication guarantees zero data loss (low RPO) but introduces write latency due to network round-trips, while asynchronous replication offers low latency but risks data loss during failures. 4. Discuss Read/Write implications, noting that secondary nodes often handle read scaling in both modes. 5. Conclude with a scenario-based recommendation, suggesting when an Oracle-style enterprise environment would prioritize one over the other based on criticality versus performance needs.

Key Points to Cover

  • Clear definition of Primary-Secondary topology and write flow
  • Explicit comparison of synchronization mechanisms and their impact on commit timing
  • Direct analysis of Write Latency vs. Data Loss Risk (RPO)
  • Understanding of Read Scaling capabilities in both modes
  • Context-aware recommendation linking technical choice to business requirements

Sample Answer

In a Primary-Secondary architecture, all write operations are directed to the primary node, which then propagates changes to secondary replicas. The core distinction lies in how we handle these propagations. Synchronous replication requires the primary to wait for confirmation from at least one secondary before acknowledging the write to the client. This ensures strong consistency and near-zero Recovery Point Objective (RPO), meaning no data is lost if the primary fails. However, this significantly increases write latency because the operation is blocked by the slowest network round-trip among the nodes involved. Conversely, asynchronous replication allows the primary to acknowledge the write immediately after updating its local storage, pushing updates to secondaries in the background. This drastically reduces write latency and improves throughput, making it ideal for geographically distributed systems where network delay is high. The downside is a non-zero RPO; if the primary crashes before syncing, recent transactions are lost. In an Oracle context, I would recommend synchronous replication for financial transaction ledgers where data integrity is paramount, accepting higher latency. For logging or analytics pipelines where eventual consistency is acceptable, asynchronous replication provides the necessary performance without compromising overall system stability.

Common Mistakes to Avoid

  • Confusing Replication Lag with Consistency Models, failing to link lag directly to RPO risk
  • Ignoring Network Latency as a critical factor in Synchronous replication performance degradation
  • Suggesting one method is universally superior without mentioning specific use-case constraints
  • Failing to mention that Secondary nodes might still serve stale reads depending on configuration

Practice This Question with AI

Answer this question orally or via text and get instant AI-powered feedback on your response quality, structure, and delivery.

Start Practicing

Related Interview Questions

Browse all 150 System Design questionsBrowse all 24 Oracle questions