ACID Transactions & Isolation Levels in Core Banking

Answer-first: Enforcing ACID isolation levels in core banking prevents lost updates and dirty reads during high-concurrency transfers. Using PostgreSQL REPEATABLE READ or pessimistic row locking (SELECT FOR UPDATE) combined with Go connection pooling guarantees transactional integrity. Spanner and CockroachDB provide linearizable distributed ACID transactions across microservices using Paxos consensus and Hybrid Logical Clocks. Prerequisite: Part 2: CASA & Lending Domain Logic on transaction parameters. The Core Problem: Concurrency Answer-first: High-concurrency banking transfers risking race conditions and lost updates require strict database lock isolation to protect ledger state. ...

May 6, 2026 · 14 min · Lê Tuấn Anh

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

Prerequisite: Part 6 of the System Design Masterclass. Read Part 5: Kafka & Event-Driven first. Distributed Locks in Go — Redlock Math, etcd & Split-Brain Answer-first: Distributed locks enforce mutual exclusion across independent microservice instances. Redis Redlock achieves high-performance locking across quorum master nodes with Lua-script atomicity, while etcd provides linearizable Raft-backed leases with fencing tokens to guarantee absolute safety under network partitions. Key Takeaways: Redlock Validity Formula: Lock validity equals $\text{TTL} - \text{elapsed_time} - \text{clock_drift}$; if validity $\le 0$, release immediately. Fencing Tokens: Monotonically increasing fencing tokens (e.g. etcd revision numbers) block delayed GC-paused lockholders at storage layer boundaries. Raft vs Redis Quorum: Use etcd for high-correctness financial transactions and Redis Redlock for high-throughput rate limiting or worker job distribution. What You’ll Learn Redlock Clock Drift Math: Why unsynchronized system clocks (NTP drifts) allow two clients to acquire the same Redis lock, and how to verify with fencing tokens. Rsync Lock-Release Failures: The dangerous Lua script race condition when executing un-coordinated lock releases in Redis under network partitions. etcd Keep-Alive Overhead: How etcd’s HTTP/2 stream heartbeats impact cluster CPU utilization when holding thousands of concurrent locks. Why Do Race Conditions Occur in Distributed Systems? Key Concept: Race conditions occur across server processes when multiple servers independently read and then write shared state without coordination. A single-process mutex doesn’t help — you need a lock mechanism visible across all processes. ...

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

Agentic Search Architecture & Golang Orchestration Power

Prerequisite: Familiarity with the concepts introduced in Executive Summary. Review it first if the terminology in this part is unfamiliar. Agentic Architecture & Golang Orchestration Power Building agentic search systems in Python works well for offline evaluation or low-throughput prototypes. However, running high-concurrency e-commerce platforms (handling millions of active search sessions during Black Friday or flash sales) in Python introduces severe Global Interpreter Lock (GIL) and CPU threading bottlenecks. Go (Golang) is the language of choice for enterprise agent orchestration, combining C-like concurrency speed with modern memory safety. ...

June 11, 2026 · 5 min · Lê Tuấn Anh

Golang Goroutine Pool Patterns: errgroup & Worker Pools

Golang Goroutine Pool Patterns: errgroup & Backpressure Preventing goroutine leaks in high-concurrency worker pools using errgroup. Writing robust worker pools that propagate context cancellation to all active goroutines. Every Go engineer eventually writes the same mistake: a loop that launches goroutines unconditionally. In a demo with 10 items, this works beautifully. In production with 50,000 incoming webhook events, it spawns 50,000 goroutines simultaneously, exhausts memory, and triggers the OOM killer. Kubernetes restarts the pod. The on-call engineer gets paged at 3 AM. ...

June 1, 2026 · 14 min · Lê Tuấn Anh