Go Advanced: Performance, Concurrency, and Production
This course is for engineers running Go in production who need bounded resource usage, measurable latency improvements, and safe deployment containers. You begin by replacing unbounded goroutine fan-out with worker pools, coordinated cancellation via errgroup, leak-free timers, and lock-contention diagnostics.
Every performance change in the middle sections is backed by measurements: go test -bench -benchmem, CPU and heap profiles in pprof, compiler escape analysis, sync.Pool trade-offs, and runtime execution traces. You finish by hardening services with jittered backoff, request body caps, fuzz testing, type-safe generics, stripped static builds, and minimal non-root container images with CA certificates and GOMEMLIMIT.
Course access
-
Bounded Concurrency and Worker Pools (empty)3Lessons · 15 min
-
Bound Concurrency With a Worker Pool
Limit active goroutines using a fixed worker pool reading from a jobs channel and respecting context cancellation. After this, spikes in work will not exhaust file descriptors or memory.
5 min -
Coordinate Shared State With sync.Mutex and atomic
Protect shared counters and maps with sync.Mutex or sync/atomic, keep lock hold times short, and verify with -race. After this, you can choose between mutexes, atomics, and channels cleanly.
5 min -
-
-
Memory, Allocations, and Benchmarking (empty)3Lessons · 15 min
-
Measure Speed and Allocations With go test -bench
Write Go benchmarks with testing.B, enable allocation reporting with -benchmem, and compare string concatenation vs strings.Builder. After this, you can measure changes instead of guessing.
5 min -
Cut Allocations With Pre-Sizing and sync.Pool
Reduce heap allocations using pre-sized slices and sync.Pool for reusable buffers, and confirm gains with benchmarks. After this, hot paths allocate far less garbage.
5 min -
-
-
Profiling and Diagnostics (empty)3Lessons · 15 min
-
Find CPU and Heap Hotspots With pprof
Capture a CPU or heap profile with runtime/pprof and inspect top functions using go tool pprof -top. After this, you can locate real bottlenecks before rewriting code.
5 min -
Catch Goroutine Leaks and Slow Tests Early
Write tests that cancel contexts cleanly, use t.Cleanup, and catch leaked goroutines and hangs with go test -timeout. After this, background leaks fail in CI instead of production.
5 min -
-
-
Resilience and Defensive HTTP (empty)3Lessons · 15 min
-
Add Retries With Backoff and Jitter
Retry transient failures with exponential backoff and jitter while respecting context deadlines and skipping non-retryable 4xx responses. After this, callers recover from brief blips without thundering herds.
5 min -
Protect Endpoints With Rate Limiting and Panic Recovery
Wrap handlers with panic recovery that logs stack traces safely and enforce simple per-key request limits. After this, one unexpected panic or burst will not take down the server.
5 min -
-
-
Production Builds and Containers (empty)3Lessons · 15 min
-
Embed Static Assets and Version Info With embed and ldflags
Bundle templates or static files into the binary with //go:embed and inject release versions with -ldflags "-X ...". After this, your binary carries its own assets and build metadata.
5 min -
Ship a Multi-Stage Scratch Go Container
Build a static Go binary in golang:trixie and copy only the binary, CA certificates, and non-root user into FROM scratch. After this, your production image is tiny and has no shell.
5 min -
-
-
Fuzzing, GC Tuning, Tracing, and Reflection (empty)5Lessons · 25 min
-
Fuzz Testing Parsers and Decoders With go test -fuzz
Write FuzzX(f *testing.F) targets and run go test -fuzz to uncover edge-case panics in parsers and decoders. After this, fuzz-discovered inputs stay in testdata/fuzz as regression tests.
5 min -
Escape Analysis and GC Tuning (-gcflags="-m", GOGC, GOMEMLIMIT)
Read compiler escape analysis output with -gcflags="-m" and set GOMEMLIMIT safely in containers. After this, heap allocations and container OOMs are predictable.
5 min -
Execution Tracing and Block/Mutex Contention Profiling
Capture mutex contention profiles and execution traces with -mutexprofile and -trace to diagnose scheduler stalls. After this, lock contention and GC pauses are visible in real numbers.
5 min -
Reflection, Struct Tags, and go generate
Inspect struct tags with reflect cleanly and choose between reflect, generics, and go generate. After this, you use reflection where it fits without paying hot-path overhead.
5 min -
-
About
This course is for engineers running Go in production who need bounded resource usage, measurable latency improvements, and safe deployment containers. You begin by replacing unbounded goroutine fan-out with worker pools, coordinated cancellation via errgroup, leak-free timers, and lock-contention diagnostics.
Every performance change in the middle sections is backed by measurements: go test -bench -benchmem, CPU and heap profiles in pprof, compiler escape analysis, sync.Pool trade-offs, and runtime execution traces. You finish by hardening services with jittered backoff, request body caps, fuzz testing, type-safe generics, stripped static builds, and minimal non-root container images with CA certificates and GOMEMLIMIT.
- Responsible
- Jay P
- Last Update
- 11/27/2026
- Completion Time
- 1 h 40 min
- Members
- 1
Reviews
Sign in to write a reviewComments
Sign in to commentNo comments yet.