InfraMaxx

Track

Go for Infrastructure lessons

40 short lessons on Go for Infrastructure. Each one starts from a real situation, shows how it works, and ends with a quiz. Free to read.

Start with the first lesson

All 40 lessons

  1. Goroutine schedulingBeginner · 4 min

    Go goroutines are lightweight user-space tasks scheduled onto OS threads by the Go runtime. They are not always in one-to-one correspondence with threads. Channels…

  2. GMP schedulerBeginner · 4 min

    Go schedules goroutines on operating system threads using runtime execution resources.

  3. ChannelsBeginner · 4 min

    A typed channel transfers values between goroutines and can synchronize a handoff.

  4. Select fairnessBeginner · 4 min

    A Go select chooses one ready communication; source order is not priority.

  5. Context cancellationBeginner · 4 min

    A Go context communicates cancellation and deadlines to code that observes it.

  6. WaitGroupsBeginner · 4 min

    A WaitGroup lets a caller wait for a set of tasks to finish.

  7. Mutex and RWMutexBeginner · 4 min

    A mutex coordinates access to shared state; an RWMutex permits multiple readers or one writer.

  8. Atomic operationsBeginner · 4 min

    sync/atomic performs a read-modify-write on one value as a single indivisible operation.

  9. Race detectorBeginner · 4 min

    Go’s race detector reports certain unsynchronized accesses in code paths exercised by a run.

  10. Worker poolsBeginner · 4 min

    A worker pool bounds concurrency with a fixed number of goroutines reading jobs from one channel.

  11. Bounded concurrencyBeginner · 4 min

    Bounded concurrency limits how many operations are active while a separate queue holds waiting work.

  12. Backpressure in GoBeginner · 4 min

    Explain backpressure in Go as a bounded channel or semaphore that makes fast producers wait, so queued work cannot grow memory without limit during a traffic spike.

  13. HTTP server timeoutsBeginner · 4 min

    Explain what each net/http server timeout limits, and set them so slow or stalled clients cannot hold connections and goroutines open indefinitely on a public API.

  14. net/http transportBeginner · 4 min

    Explain how the Go HTTP transport pools idle connections, why a per-request client causes churn, and how to size the pool and drain bodies so connections are reused.

  15. Connection reuseBeginner · 5 min

    Explain why a client that reuses an idle connection the server already closed gets EOF errors, and set its idle timeout below the shortest limit on the path.

  16. DNS resolverBeginner · 5 min

    Explain how the Go resolver queries the servers in resolv.conf in order, why one dead nameserver causes steps of delay, and how to test each server on its own.

  17. TLS clientsIntermediate · 5 min

    Explain how a Go TLS client builds the certificate chain and checks the host name, and fix chain errors by correcting the server or the trust roots, not by disabling…

  18. Error wrappingIntermediate · 5 min

    Explain how fmt.Errorf with %w builds an error chain and how errors.Is and errors.As read it, so a sentinel error still reaches the handler that picks the status code.

  19. Structured loggingIntermediate · 4 min

    Explain why structured log fields with stable names and types can be filtered exactly, and how to keep secrets and sensitive values out of the log stream.

  20. Prometheus instrumentationIntermediate · 4 min

    Explain why each unique label combination adds a Prometheus time series, and choose metric types, names and labels that stay bounded as the system grows.

  21. OpenTelemetry tracingIntermediate · 5 min

    Explain spans, trace context propagation and sampling in OpenTelemetry, so the time one request spends can be followed across services, queues and background jobs, with…

  22. Profiling with pprofIntermediate · 5 min

    Explain what CPU, heap and goroutine profiles show, how to capture them during a problem, and how to read a top list and source lines with go tool pprof.

  23. Memory escapesIntermediate · 4 min

    Explain how escape analysis decides whether a value lives on the stack or the heap, and how to read compiler output and benchmark allocations before changing code.

  24. Garbage collection tuningIntermediate · 5 min

    Explain how GOGC and GOMEMLIMIT set the trade-off between heap memory and garbage collection CPU, and how to leave headroom under a container memory limit.

  25. Graceful shutdownAdvanced · 5 min

    Explain how a Go server drains on SIGTERM, so in-flight requests finish and the shutdown deadline fits inside the platform's grace period before SIGKILL arrives.

  26. Goroutine scheduling: failure analysisAdvanced · 4 min

    Explain how parked goroutines keep their memory after they stop running, how to count and group them, and how to find the wait point that never returns.

  27. GMP scheduler: operational verificationAdvanced · 5 min

    Explain how GOMAXPROCS caps parallel Go code, how threads and processors relate to goroutines, and why too many threads stall under a CPU quota in a container.

  28. Channels: failure analysisAdvanced · 5 min

    Explain how sends and receives block on channels, why a nil or unowned channel hangs, and how a select with a context case lets blocked goroutines exit.

  29. Select fairness: operational verificationAdvanced · 5 min

    Explain how select chooses among ready channels by uniform pseudo-random selection, so source order gives no priority, and how a nested select can give one channel…

  30. Context cancellation: failure analysisAdvanced · 4 min

    Explain how a Go context cancels work, why a deadline does not stop a goroutine on its own, and how to find the calls that ignore it.

  31. WaitGroups: operational verificationAdvanced · 4 min

    Explain how a WaitGroup counts outstanding goroutines in a fan-out job, why Add must run before Wait, and how a copied WaitGroup makes the job finish early.

  32. Mutex and RWMutex: failure analysisAdvanced · 4 min

    Explain how Mutex and RWMutex protect shared data, why a waiting writer can deadlock a recursive read lock, and how to find lock waits in a goroutine dump.

  33. Atomic operations: operational verificationAdvanced · 4 min

    Explain what sync/atomic guarantees for one value, why two atomic loads do not form a snapshot, and why 64-bit fields need alignment on 32-bit targets.

  34. Race detector: failure analysisAdvanced · 4 min

    Explain what the Go race detector reports, why a clean run covers only executed code, and how to choose race builds for tests versus production.

  35. Worker pools: operational verificationAdvanced · 4 min

    Explain how a worker pool shares a jobs channel, why the sender should close a channel, and how a done channel stops blocked sends at shutdown.

  36. Bounded concurrency: failure analysisAdvanced · 4 min

    Explain why a goroutine for each item needs a semaphore acquired before the go statement, and how to size a limit against a shared resource.

  37. Backpressure in Go: operational verificationAdvanced · 4 min

    Explain how a buffered channel holds queued work, why a large buffer is a hidden queue, and how blocking, dropping and rejecting handle a full buffer.

  38. HTTP server timeouts: failure analysisAdvanced · 4 min

    Explain which net/http Server timeout covers each phase of a request, and how a missing read timeout lets slow clients hold file descriptors for long periods.

  39. net/http transport: operational verificationAdvanced · 4 min

    Explain what Client.Timeout covers in net/http, why the default client can hang on a silent server, and how transport limits narrow down the stalled phase.

  40. Connection reuse: failure analysisAdvanced · 4 min

    Explain why HTTP/1.1 connections are persistent by default, and how response bodies that are not closed stop connections from returning to the idle pool, so new ones…