Part 7: Load Testing and Performance Tuning for Production

Load testing is the final boss of System Design. A junior engineer runs a script, sees “20,000 RPS” with 0 errors, and assumes the system is ready. A Principal Engineer knows that unless you tune the Linux Kernel, bypass Coordinated Omission, and simulate realistic chaos, that number is a complete lie. Answer-first: Load testing a routing engine is not just about testing your Go code. It is a brutal stress test of the Linux Kernel network stack (sockets, TCP reuse, SOMAXCONN), the Go runtime scheduler, and the memory footprint of your load testing tool itself. ...

June 15, 2026 · 4 min · Lê Tuấn Anh

Go 1.26: Green Tea GC, Faster CGO & Goroutine Leak Detection

Answer-first: Go 1.26 ships three landmark runtime features: the Green Tea garbage collector (10–40% GC overhead reduction), ~30% faster cgo calls for AI inference bindings, and an experimental goroutine leak profile that detects permanently blocked goroutines via GC reachability analysis. What You’ll Learn That AI Won’t Tell You Performance metrics of garbage collection optimization in Go 1.26. Memory overhead trade-offs when calling CGO functions in high-throughput network threads. Released in February 2026, Go 1.26 is not a routine patch release. It fundamentally changes how the Go runtime manages memory, interacts with C code, and surfaces concurrency bugs. For teams running Golang microservices at scale, these improvements compound across a fleet — zero code changes required. ...

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

Chapter 5: Optimizing Golang Database Connection Pools

← Previous | Series hub | Next → Chapter 5: Unlocking Database Performance via Connection Pooling If your Golang system processes business logic blazingly fast but chokes at the Database layer, 90% of the time, it is due to an incorrectly configured *sql.DB. 1. Understanding *sql.DB Answer-first: In Golang, sql.Open() does NOT create a direct database connection. It instantiates a thread-safe Connection Pool manager. You must initialize the db variable only once during app startup. ...

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

Go pprof in Kubernetes: CPU & Memory Profiling

Answer-first: Go pprof is the standard library profiling tool for diagnosing CPU usage, memory allocation, and goroutine leaks in production Go services, with safe exposure via internal HTTP endpoints and minimal performance overhead when configured correctly. What You’ll Learn That AI Won’t Tell You Reading memory profiles to identify slow allocations in performance hot paths. Analyzing flame graphs to detect lock contention on global mutexes. Prerequisite: This guide covers how to profile and diagnose complex performance issues in production. If you are specifically dealing with unbounded goroutine growth, ensure you first understand the foundational concepts in Goroutine Leak Detection and Fix in Production Go Services. ...

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

Go pprof in Kubernetes: Remote Profiling & Flame Graphs

Answer-first: Safely profile production Go services in Kubernetes by establishing a secure kubectl port-forward to the runtime’s pprof endpoint. Collecting CPU, memory, and goroutine profiles in real-time allows generating flame graphs or streaming data to Pyroscope without introducing high overhead. What You’ll Learn That AI Won’t Tell You Production port forwarding configuration to profile CPU without service downtime. Decoding complex memory profiles and locating garbage collection allocation hot paths. You’ve instrumented your Go service with net/http/pprof, run go tool pprof locally against the development binary, and spotted the hot path in your flame graph. Then you deploy to Kubernetes and the bottleneck disappears — because the workload profile in Kubernetes differs from local testing (different request mix, connection pool pressure, GC behavior under actual memory pressure, scheduler interference from co-located pods). ...

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

Astro on Cloudflare: Full-Stack Edge Architecture

Answer-first: Deploying Astro on Cloudflare Pages utilizes V8 isolates for near-zero cold starts and global edge execution. The architecture relies on D1 edge database bindings, Durable Objects for real-time state, and Cloudflare CDN caching policies to deliver high-performance, cost-effective web applications. What You’ll Learn That AI Won’t Tell You The exact D1 edge database connection pooling limitations and how to circumvent cold start issues when routing through Neon serverless proxies. How to configure Durable Objects for real-time state synchronization without hitting Cloudflare’s sub-request quota limits. Running a content site on a traditional VPS or a managed Node.js host is fine until it isn’t. You pay for compute that sits idle 95% of the time, you manage SSL renewals, you worry about cold starts, and you watch your Lighthouse score suffer because your origin is in Singapore while your readers are in Frankfurt. ...

April 24, 2026 · 15 min · Lê Tuấn Anh