Back to course

Buffered Channels and Throughput

Go (Golang) for Cloud-Native Microservices

Buffered Channels

By default, channels are unbuffered (capacity 0). A buffered channel allows sending a limited number of values without a corresponding receiver.

go ch := make(chan int, 100) // Capacity of 100

Why use them?

They act as a queue, helping handle bursts of traffic in your microservice without blocking the sender immediately.