Active-Standby Redundancy

A high-availability pattern where only one machine actively runs workloads while standby nodes remain ready to take over upon failure, preventing dual-execution disasters while ensuring resilience.

General Meaning

Active-Standby redundancy is a fundamental high-availability architecture pattern where exactly one active node processes operational workloads and batch tasks, while one or more standby nodes stay synchronized in a waiting state.

Compared to an active-active setup where all nodes process traffic simultaneously, an active-standby topology prevents simultaneous write conflicts and data inconsistency. When the active node fails due to power loss, network partitions, or hardware crashes, standby nodes detect heartbeat loss and automatically promote a replacement through failover.

Why It Matters

  • Preventing catastrophic dual execution: Running periodic maintenance or batch tasks on multiple machines simultaneously causes duplicate external API calls, Git conflicts, and data corruption.
  • Eliminating single points of failure (SPOF): When the primary machine reboots, crashes, or stalls under heavy load, standby nodes automatically assume duties to maintain continuous operations.
  • Simplifying architectural coordination: Because only one node is active at any time, systems avoid the intricate distributed consensus protocols required by multi-master active-active clusters.

How the Site Factory Uses It

In the Site Factory, identical daemon programs—the patrol inspector patrol, internal coordinator macgakari, operations scheduler unkou, and site patrol site-patrol—are deployed across all three home Macs (Mac mini, Studio 1, and Studio 2). Which node actively runs is determined dynamically by a service lease token stored in Cloudflare D1.

The node that acquires the D1 service lease (TTL 40 minutes) upon launchd startup acts as the active worker, renewing the lease every 5 minutes during long-running tasks. Standby nodes query D1, receive HTTP 409 Conflict if another node holds the lease, and exit immediately without side effects. If the active Mac crashes or fails to renew three consecutive times, the lease expires after 40 minutes, and an idle standby Mac claims the lease to safely resume operations without cluster interruption.

Caveats & Operational Rules

  • Never permit unilateral standby self-promotion: Standby nodes must never promote themselves autonomously without central verification; only the node that successfully secures the central D1 lease can become active to avoid split-brain scenarios.
  • Fencing delayed writes from stale active nodes: To prevent a recovering former active node (delayed by network lag or memory pressure) from writing stale data, lease renewals are guarded with monotonically incrementing fencing tokens.
  • Avoid assuming uniform hardware capability: Nodes have different hardware specs (e.g., 16 GB Mac mini vs high-memory Mac Studios); while orchestration daemons run in active-standby, demanding AI workloads are partitioned into tiered pipelines matching machine memory.

Related Terms

References

  • Book: Martin Kleppmann, *Designing Data-Intensive Applications*, Chapter 8 (Trouble with Distributed Systems: Split-Brain and Leader Election)

Verified: 2026-11-08