PATTERN Cited by 1 source
Active-active with single-execution guarantee¶
Pattern¶
Deploy processing infrastructure in multiple regions, all simultaneously live and capable of handling events, but enforce exactly-once execution via a distributed lock. This distinguishes the pattern from:
- Naive active-active — both process, causing duplicate side effects.
- Active-passive — secondary is idle until failover, wasting recovery time on cold-start.
The key insight: active-active availability and single-execution correctness are not contradictions if you add a coordination layer (distributed lock + idempotency record).
Mechanism¶
- Event arrives at both regions (via fan-out).
- First handler to acquire a conditional-write lock in a globally-replicated store wins.
- Winner executes business logic and records completion.
- Loser checks lock state, sees it's claimed, skips silently.
- If winner fails mid-execution, lock expires or stays un-completed — loser (on retry/delay) acquires and takes over.
Comparison to related approaches¶
| Approach | Availability | Duplicate risk | Failover speed |
|---|---|---|---|
| Active-passive | One live, one idle | None | Slow (cold-start) |
| Naive active-active | Both live | High | Instant |
| This pattern | Both live | None (lock-guarded) | Fast (delay window) |
Trade-offs¶
| Pro | Con |
|---|---|
| Zero-downtime failover — secondary is already warm | Requires globally-replicated lock store (cost, complexity) |
| No duplicate side effects | Replication lag bounds minimum failover delay |
| Both regions exercised continuously (no cold-start surprise) | Lock contention possible under very high event rates |
Seen in¶
- sources/2026-07-22-aws-building-multi-region-resiliency-for-cloudformation-custom-resources — CloudFormation custom resource handlers in us-east-1 + us-west-2, DynamoDB Global Table as lock store, SQS delay for secondary (AWS Architecture Blog, 2026-07-22).