Skip to content
SEE Exam Prep

Question 5 of 11 · PYQ 2025 · 6 marks

Open in ChatGPT

Explain fault tolerant services in distributed systems.


Introduction

A fault-tolerant service keeps answering correctly while components fail. Building one means deciding what "correct" means under failure, masking the faults from the client, and recovering the replicas afterwards.

The layers of tolerance

  1. Replication. Stateless services are replicated behind a load balancer, which simply stops sending to a failed instance. Stateful services need active or passive replication with a total-order multicast or a primary that forwards updates.
  2. Failure detection. Heartbeats and leases decide when a replica is gone. A false positive removes a healthy replica, so a lease is preferred over a naive timeout: it bounds how long two primaries can exist.
  3. Redundancy in the request path. Retries with an idempotency key, so a client can safely resend a request whose reply was lost.
  4. Persistence. A replica that crashes must rebuild its state from a checkpoint and a log, not from another live replica's memory.
  5. Quorum. A decision needs a majority of replicas, so the service tolerates a minority of failures and never makes conflicting decisions.

What the client sees

  • At-most-once and idempotent operations: retries are safe because the duplicate is suppressed.
  • Graceful degradation: if a replica set shrinks below quorum, the service refuses writes rather than accepting inconsistent ones: availability is traded for correctness, visibly.
  • Bounded recovery: the promise is a recovery time, not instant perfection.

Example

  • A payment service runs three replicas behind a consensus log.
  • A write commits once a majority acknowledges, so a replica crash loses no committed write.
  • Leader election promotes a follower within the lease interval.
  • A client retry with the same idempotency key returns the original result instead of charging twice.

Conclusion

A fault-tolerant service is replication plus detection plus a decision rule. Replication gives a spare, detection decides when to use it, and the quorum rule decides what the spare is allowed to claim.