Skip to main content

Fault; primary-backup vs active

Short answer

A fault is a defect causing error/failure. Primary-backup replication: one primary processes requests, updates backups, replies after acks; on failure, a backup is elected. It differs from active replication: only primary executes requests, state transfer needed, failover delay, tolerates only crash faults; active replication multicasts to all replicas in total order, masks failures immediately, and can handle Byzantine faults with voting.

What is fault? How to implement primary-backup replica system? How is it different from active replication?

Fault

A fault is the defect or cause (a broken component, a software bug, a bad link) that may lead to an error, an incorrect internal state. An error that reaches the service interface and makes the system deviate from its specification is a failure. Faults are classified as transient (occur once and vanish), intermittent (appear and disappear repeatedly) and permanent (persist until the component is repaired).

Primary-backup replication

In primary-backup (passive) replication, one replica is the primary and the others are backups. Clients send requests only to the primary.

  1. The primary receives the request, executes it and updates its state.
  2. It sends the state update (or the request with its result) to all backups and waits for their acknowledgements.
  3. It then replies to the client.
  4. Backups only keep their copies up to date; they do not process client requests.
  5. If the primary fails (detected by heartbeat/timeout), the backups elect a new primary (e.g. the one with the lowest id, or the most up-to-date one) and clients are redirected to it.
Client --> Primary --update--> Backup 1
              |      --update--> Backup 2
              v
           reply to client

All writes are ordered at the primary, so consistency is easy to achieve (the service is linearizable while the primary is correct). The drawbacks are the delay of waiting for the backups and the switch-over time when the primary fails. It tolerates K crash failures with K+1 replicas, but cannot handle Byzantine failures.

Difference from active replication

PointPrimary-backupActive replication
Who processes requestsOnly the primaryAll replicas
Request deliveryTo primary onlyMulticast to all, in the same total order
State transferPrimary sends updates to backupsNone; each replica executes the same operations
Failure of a replicaSwitch-over needed if the primary failsMasked immediately; others continue
DeterminismNot requiredOperations must be deterministic
OverheadLess CPU, update messagesMore CPU; needs totally ordered multicast
Failure typesCrash onlyCan handle arbitrary failures with voting

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 7 questions →