Distributed Locks in Go — Redlock Math, etcd & Split-Brain

Answer-first: Distributed locks solve the mutual exclusion problem across independent servers — ensuring only one server can modify a shared resource at a time. Redis Redlock provides high-performance locking using majority quorum across multiple master nodes; etcd provides stronger guarantees via Raft consensus at the cost of higher latency. Prerequisite: Part 6 of the System Design Masterclass. Read Part 5: Kafka & Event-Driven to understand event sourcing patterns before tackling lock coordination. ...

June 18, 2026 · 8 min · Lê Tuấn Anh

Chapter 8: Distributed Locking — Redlock vs ZooKeeper

Prerequisite: Before reading this chapter, please ensure you have read the previous article in this series: Chapter 7: Fortifying Payment Systems with Idempotent APIs. In a standalone Go application, preventing two Goroutines from overwriting the same data (Race Condition) is achieved via sync.Mutex. However, when your system scales out to 10 servers behind a Load Balancer, sync.Mutex is useless because it only locks local RAM. You need a Distributed Lock. ...

June 9, 2026 · 7 min · Lê Tuấn Anh