"Why is our service slow?" "I don’t know, the heap is only 200MB." "But we’re allocating… wait, how much?" "12 terabytes." "…in how long?" "30 seconds profile." That’s when we realized: we weren’t running a service. We were running a garbage factory that occasionally served API requests. The Go garbage collector was heroically trying to clean up our mess, and we were blaming it for not cleaning fast enough. This deep dive into GC internals, profiling tools, and production war stories will teach you how to stop fighting the garbage collector and start working with it
In the world of high-throughput backend services, we often obsess over the usual suspects of performance: database indexing, network latency, and algorithmic complexity.
But recently, while debugging our core gateway service (backend-gw), I encountered a bottleneck that defied standard logic.