Going back to Go: Concurrency Patterns
· One min read
Building blocks for concurrency in go (goroutine, channel) and patterns (fan out).
TODO
- concurrency is not parallelism by rob pike https://go.dev/blog/waza-talk
Basic
- start (and stop) go routine
- channel, buffer, not buffered, select
Patterns (I can think of top of my head)
- pipeline
- fan out (one web page has multiple links)
- fan in, wait until multiple part download has finished
- limit parallelism, e.g. at most two concurrent outgoing requests
Libraries
- error group
- single flight
Top google search results
- https://go.dev/blog/pipelines Go Concurrency Patterns: Pipelines and cancellation
- https://github.com/lotusirous/go-concurrency-patterns
- https://www.oreilly.com/library/view/concurrency-in-go/9781491941294/ch04.html book from oreilly
- https://reliasoftware.com/blog/golang-concurrency-patterns generator pattern?