Hi,
I've been facing this question for a while and never managed to find the "right" answer. Hopefully this forum will be able to enlighten me a little bit.
Given a very simple pattern: Consume some data, transform it, store it (ETL). The storing part is slow(er) and needs to be fanned out.
The question: What's the best (correct? idiomatic?) way to implement that in Go?
A) From "main", buffer the incoming data and launch a goroutine and pass it the data to store. Similar to how you could implement a web server handling an incoming connection in Go.
OR
B) From "main", create N channels and spin up N goroutines to send down data to workers. Round-robin writes to the N channels.
B1) Do you buffer the data in "main" or after the channel, in the goroutine?
I understand that (A) can spin out of control and launch too many goroutines and (B) can run into a bottle neck. Each of these problems can be easily addressed. I'm more interested in hearing what you think is the "right" way to solve this problem?
Thanks
David