Quick revision
The short answer
We start by asking what a minute of downtime and a minute of lost orders actually cost, because zero is not affordable for every kind of failure. Then we separate the failure scenarios, node, zone, region, operator error such as a bad migration, and data corruption, and give each its own RPO and RTO, for example zone failure RPO 0 and RTO 1 minute, region failure RPO 30 seconds and RTO 30 minutes, operator error recovered through PITR within 2 hours. Each target gets a mechanism, synchronous standbys, cross-region replicas, PITR or a delayed replica, and we document, test and agree the costs with the product owner.
What to remember
In this answer, we saw how to turn zero data loss and zero downtime into something deliverable. We asked what downtime and lost orders really cost, separated node, zone, region, operator error and corruption scenarios, gave each its own RPO and RTO, and chose a mechanism per scenario: synchronous standbys, cross-region replicas, PITR and a delayed replica. We then designed the application for retries, documented the agreement with its costs and proved it with drills.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
We start by asking what a minute of downtime and a minute of lost orders actually cost, because zero is not affordable for every kind of failure. Then we separate the failure scenarios, node, zone, region, operator error such as a bad migration, and data corruption, and give each its own RPO and RTO, for example zone failure RPO 0 and RTO 1 minute, region failure RPO 30 seconds and RTO 30 minutes, operator error recovered through PITR within 2 hours. Each target gets a mechanism, synchronous standbys, cross-region replicas, PITR or a delayed replica, and we document, test and agree the costs with the product owner.
Why this question is asked
Zero data loss and zero downtime is a sentence almost every product owner says at some point, and it is a good sign: it means they care. Taken literally, though, it cannot be delivered for every possible failure at any price, and an engineer who just nods will be blamed when the first incident shows it was never true. Interviewers ask this to see whether we can turn a wish into targets, a design and an agreement. In this answer, we will start with the business impact conversation, break the problem into failure scenarios, set targets per scenario, choose a mechanism for each, and finish with how we document, test and agree it.
1Start With What Downtime and Loss Actually Cost
The first step is a conversation, not a diagram. We ask the product owner what happens to the business when the order service is down for one minute, ten minutes, an hour. Perhaps checkout stops and the company loses 4,000 dollars a minute at peak, but customers mostly retry later, so the real loss is smaller. Then we ask what happens if the last minute of orders vanishes: customers were charged, warehouses never heard of the orders, support calls follow. That is often worse than downtime.
These answers give us the price of a minute of each, and they usually show that loss and downtime are not equally bad, and that different failures deserve different budgets. They also set up the honest message: we can get very close to zero for the common failures, and we will be explicit about the rare ones where we cannot.
2Separating the Failure Scenarios
Zero for which failure? A server crash, the loss of an availability zone, the loss of a whole region, an engineer running a migration that drops a column, and a bug that silently writes wrong prices for a week are completely different events. Replication protects against the first three and makes the last two worse, because it copies the mistake everywhere instantly. So we list the scenarios and treat each one separately.
| Scenario | RPO | RTO | Mechanism |
|---|---|---|---|
| Database node failure | 0 | 30 s | Synchronous standby, Patroni |
| Zone failure | 0 | 1 min | Standbys in other zones, quorum commit |
| Region failure | 30 s | 30 min | Async cross-region replica, runbook |
| Operator error (bad migration) | to the minute before | 2 h | PITR, delayed replica |
| Silent data corruption | last good point | hours | PITR, audit log, reconciliation |
3Choosing a Mechanism for Each Target
For node and zone failures, we run a primary with synchronous standbys in two other zones, with quorum commit so that one slow standby does not block writes, and a failover manager that promotes only a synchronous standby. That gives RPO zero, because every acknowledged order is on disk in two zones, and an RTO of well under a minute, assuming the application handles reconnection and retries properly.
For region failure, an asynchronous replica in a second region keeps cross-region latency out of every commit. It may lose the last seconds of orders, hence an RPO of 30 seconds, and promotion plus moving the application stack takes tens of minutes, hence 30 minutes of RTO. If the product owner wants zero here too, we price the alternative: synchronous cross-region commits, adding tens of milliseconds to every order, or a distributed database across three regions.
For operator error, replication is useless. Point-in-time recovery from base backups and archived WAL lets us restore a copy to the minute before the bad migration and repair from it. A delayed replica, a standby configured with recovery_min_apply_delay of, say, one hour, gives a faster path: it still holds the data from an hour ago, so we can pause it and copy the lost data out within minutes instead of restoring terabytes.
For silent corruption, the defence is mostly in the application: an audit log of changes, reconciliation against other systems such as payment providers and warehouses, and PITR with enough retention to reach a point before the bug started.
4Designing the Application Side Too
Zero downtime is also an application property. Even with a 30-second database failover, users see errors unless the service retries safely. So the order service uses idempotency keys, a client-generated id with a unique constraint, so a retried order is not created twice; short connection and socket timeouts so it notices the failover quickly; and a retry with backoff around the whole transaction. Planned work counts too: schema changes are done with expand-and-contract migrations and rolling deployments, so releases never need a maintenance window, which in practice causes more downtime than failures do.
5Documenting, Testing and Agreeing
The final step turns the design into an agreement. We write down each scenario, its targets, the mechanism, the yearly cost and what is explicitly not covered, and the product owner signs it. That document is what we point to when someone asks during an incident why 20 seconds of orders were lost in a region failure: because we agreed that zero for that scenario would cost an extra 400,000 dollars a year and 40 ms per order.
Then we prove it. Failover drills each quarter for node and zone failures, a region exercise each year, and a PITR restore drill each month, with measured RPO and RTO recorded against the targets. When a measurement misses, we fix the gap or renegotiate the target, openly.
- Ask the cost of downtime and of lost ordersper minute, at peak
- List failure scenariosnode, zone, region, operator error, corruption
- Set RPO and RTO per scenariowith a price for each
- Choose a mechanism per scenariosync standbys, async DR, PITR, delayed replica
- Agree in writing with the product ownerincluding what is not covered
- Drill and measurefix gaps or renegotiate
6 steps in order. Play them, or step through them one at a time.
6Follow-up questions
Why not just say yes and make everything synchronous across regions?
Because it would add tens of milliseconds to every order, require a third region or a consensus database, and still do nothing for operator error or corruption. Saying yes to the literal request would cost a lot and still leave the most common causes of data loss uncovered.
What is the most common cause of data loss in practice?
In many organisations it is not hardware but people and software: bad migrations, scripts run against the wrong environment, bugs that write wrong data. That is why PITR and delayed replicas belong in the design even when replication is perfect.
How do you present the costs to the product owner?
As options per scenario: what we get, what it costs per year and per order in latency, and what risk remains. Product owners make better decisions when they choose between concrete options than when they are asked to approve one large number.
7Conclusion
In this answer, we saw how to turn zero data loss and zero downtime into something deliverable. We asked what downtime and lost orders really cost, separated node, zone, region, operator error and corruption scenarios, gave each its own RPO and RTO, and chose a mechanism per scenario: synchronous standbys, cross-region replicas, PITR and a delayed replica. We then designed the application for retries, documented the agreement with its costs and proved it with drills.
Open with
I would take the request seriously but turn it into numbers. First I would ask the product owner what a minute of downtime costs at peak and what a minute of lost orders costs, because those are usually different and tell us where to spend.
Then, if they want more
Then I would separate failure scenarios, because zero means different things for each: a database node failing, a zone failing, a region failing, an operator error like a bad migration, and silent corruption.
For each I would propose targets, for example node and zone failure RPO zero and RTO about a minute, region failure RPO 30 seconds and RTO 30 minutes, operator error recovered within two hours.
Then a mechanism per scenario: synchronous standbys in other zones with quorum commit and Patroni for the first two, an asynchronous cross-region replica and a runbook for region loss, PITR plus a delayed replica with recovery_min_apply_delay of an hour for operator errors, since replication copies mistakes instantly.
On the application side, idempotent orders with retries and expand-and-contract migrations so deployments need no downtime. If they want zero for region loss too, I would price it, tens of milliseconds per order and much higher infrastructure cost.
Finally I would write it down with costs and gaps, get the product owner to agree, and prove it with regular drills that measure the real numbers.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Product says the order service needs 'zero data loss and zero downtime'. How do you turn...": https://scrivio-interview-library.netlify.app/databases/replication-and-ha/2c9640d4f1/