Stage 3 · Build
Observability & Networking
Advanced Concurrency
errgroup, semaphore, worker pools, and pipeline patterns for parallel processing.
errgroup
errgroup manages a group of goroutines that return errors. It provides synchronized startup, error collection, and context cancellation.
Semaphore Pattern
A semaphore limits concurrent access to a resource. Use it when errgroup is not flexible enough — for example, when you need to track which goroutines are running.
Worker Pools
Worker pools run a fixed number of goroutines processing items from a channel. This is efficient for processing large volumes of work with bounded resources.
Pipeline Patterns
Pipelines connect processing stages through channels. Each stage reads from its input channel, processes, and sends to its output channel. This decomposes complex processing into composable steps.
Fan-in / Fan-out
Fan-out distributes work across multiple goroutines. Fan-in merges results from multiple goroutines into a single channel. This scales processing across available CPU cores.
Rate Limiting
Rate limiting controls how fast you send requests. Use it when calling external APIs, databases, or any resource with rate limits.
errgroup, semaphore, and other concurrency patterns are available in golang.org/x/sync. These are well-tested, production-ready implementations. Use them instead of writing your own concurrency primitives.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.