4 ms·
As per questions 2 and 3, besides the naturally single-threaded nature of node, is that having parallel producers requires a locking mechanism, and parallel con
by casual_slacker 13y ago
As per questions 2 and 3, besides the naturally single-threaded nature of node, is that having parallel producers requires a locking mechanism, and parallel consumers doesn't really make sense with these types of streams.
How do you avoid these issues with go?
- rgarcia 13y agoIn many stream pipelines you don't care about the order of the data. You just have a bunch of unordered input data that you need to transform as fast as possible. Go's channels [1] let you essentially construct loosely-typed streams. The channel's type lets you be as opinionated as you want about what should/shouldn't be passed within the "stream" (interface{}, []byte, string, MyAwesomeType, etc.). If you use buffered channels you have "backpressure". You can use > 1 core by using goroutines. [1] http://golangtutorials.blogspot.com/2011/06/channels-in-go.html http://golangtutorials.blogspot.com/2011/06/channels-in-go.h...