Go for Infrastructure
Backpressure in Go
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.
What you will be able to do
- Explain how a blocking send on a bounded channel slows a producer.
- Decide when to block a producer and when to shed load with an explicit rejection.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in Go for Infrastructure
- Worker poolsBeginner · 4 min
A worker pool bounds concurrency with a fixed number of goroutines reading jobs from one channel.
- Bounded concurrencyBeginner · 4 min
Bounded concurrency limits how many operations are active while a separate queue holds waiting work.
- 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.
- 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.
- 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.
- 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.