April 19, 2024 Designing Concurrent Rate Limiters in Go
Token buckets in Go, HTTP middleware, per-client and per-tenant limits, and why production systems eventually need a distributed limiter backed by Redis.
Token buckets in Go, HTTP middleware, per-client and per-tenant limits, and why production systems eventually need a distributed limiter backed by Redis.
How one goroutine’s writes become visible to another: happens-before, mutexes vs channels, atomics, safe publication, and catching data races in practice.
Bounding concurrency with worker pools: bounded queues and backpressure, cancellation, error handling, graceful shutdown, and sizing the pool.
What happens after go f(): the G-M-P model, run queues, work stealing, blocking syscalls, preemption, GOMAXPROCS, and how to observe it all with runtime tracing.
Goroutines and channels are only the start. Concurrency vs parallelism, the scheduler, channels vs shared memory and the memory model: what it takes to build concurrent Go services that hold up in production.
How 2PC coordinates atomic commits across nodes, a working Go implementation, the failure modes that make it a blocking protocol, and when it is the right tool.
Scaling decisions start with finding the bottleneck, not choosing a pattern. When a bigger machine is the right answer, what it takes to make a service horizontally scalable, why stateful tiers are the hard part (with...
How Raft keeps a replicated log consistent: terms, randomized elections, the log-matching check and the commit rule, with Go code for each, plus what actually breaks under real partitions and how production implementa...
The real difference between SOA and microservices isn’t service size. It’s where the logic lives and who owns the data. A side-by-side comparison, the hidden costs of a network boundary (with Go code), and a practical...
Why getting a handful of servers to agree on one value is one of the hardest problems in distributed systems: failure and timing models, FLP impossibility, why majority quorums work, and what consensus costs you in pr...