Announcing GenStage
elixir-lang.org
elixir-lang.org
The way I implemented it (with Ruby) left gaps of idle time, and huge amounts of data gets staged through the queues. I couldn't figure out how to make it better. Since I only had a week to come up with something while the infrastructure was melting down, at the time, it was acceptable. Looking at this though, the demand-based backpressure would work very well.
There are a couple problems I think I can use this in my current work -- this is great work!
Perhaps more exciting than the first part of the post is the second bit about the future. It's fantastic to see such a clear path forward for concurrency in Elixir. Definitely looking forward to GenStage.Flow
The default implementation requests more when half of the current demand is processed. So if you set :max_demand to 100, when the consumer has processed 50 events, we request 50 more.
[0]: https://www.youtube.com/watch?v=YaUPdgtUYko [1]: https://www.youtube.com/c/erlangsolutions/videos
http://learnyousomeerlang.com/the-hitchhikers-guide-to-concu...
These days there is such an explostion of languages, frameworks, techniques etc it must be scary for a beginner. Given that, i'd advise to go by the safe (average) path.
Well you see where this is going. I think it's important to learn about Threads, Mutexes, Condition Variables, and why sharing isn't caring, but I don't think those lessons necessarily need to come before learning about the Actor model.
Most devs go from OO to FP because of dominance of OO in industry (with knock-on effects on pedagogy) from sometime around the late-1980s/early-1990s until recently. Shortly before that, the same would be true of procedural to either OO or FP. And probably at one point the same would have been true of unstructured imperative to procedural.
But that doesn't mean that concurrency in popular OO languages of today is easier than concurrency in Erlang/Elixir (which may be examples of functional-ish languages, which I assume is the relevance of your OO to FP statement), nor does it mean that concurrency in formerly popular procedural languages is easier than in any particular OO language, or that concurrency in unstructured imperative languages is easier than in any particular procedural language.
As I understand it GenServer is kind of a wrapper over erlang's underlying OTP genserver abstraction. (Is that correct?)
What's GenStage's relationship to erlang? Does erlang have an equivalent?
For example: You have an Elixir load balancer that manages requests for three other servers and distributes load based on the 'demand' that the consumer communicates back to the balancer?
Are there any plans to use these primitives to communicate with servers not written in Elixir? For example can you foresee Elixir being used to manage and coordinate heterogeneous architectures?