4 ms·
Actor systems differ in their means of communication. While actor systems use the actors as the main units that you connect, with fire and forget messaging to e
by samuell 6y ago
Actor systems differ in their means of communication. While actor systems use the actors as the main units that you connect, with fire and forget messaging to each actor's inbox, FBP proposes communication between named ports over channels with bounded buffers, very much like the CSP implementation in Go (just that you have long running components as in actor systems -
something that can easily be implemented in Go with structs with go channels in fields for the ports, as shown in the FlowBase library I mentioned in another comment).
The FBP model provides implicit backpressure, because of the bounded buffers on the channels. The actor model on the other hand is more loosely coupled and flexible.
This actually means FBP systems are slightly more optimal for efficient within-one-node, in-memory parallellisation, whereas actor systems shine more for distributed systems.
They shine on different scales, in other words.
I wrote a post many years ago on this, that seems to have aligned with the experience of a number of people, based on the reactions in the comments:
https://rillabs.com/posts/flowbased-vs-erlang-message-passing https://rillabs.com/posts/flowbased-vs-erlang-message-passin...
- Nullabillity 6y agoAkka Streams adds named ports and defined backpressure, as well as a graphical-ish DSL for connecting everything.[0] [0]: https://doc.akka.io/docs/akka/current/stream/stream-graphs.html https://doc.akka.io/docs/akka/current/stream/stream-graphs.h...
- samuell 6y agoThat is nice to see! I was evaluating Akka a bit some years ago.
- rad_gruchalski 6y agoAkkaHttp is written on top of Streams. There are many more things written using it but Http is a good example to learn from.
- jghn 6y agoIt is worth noting that Akka Streams is an implementation of the Reactive Streams [0] spec, using Akka [0]: https://www.reactive-streams.org https://www.reactive-streams.org
- bcrosby95 6y ago> The FBP model provides implicit backpressure, because of the bounded buffers on the channels. The actor model on the other hand is more loosely coupled and flexible. Note that this is why people recommend using GenServer's "call" instead of "cast" in Elixir/Erlang by default - it applies a sort of backpressure because call waits for the process to return a result rather than being fire and forget. It's not exactly the same thing, or as configurable as Go channels, but it is an option.
- pythonaut_16 6y agoElixir has several tools built around solving this problem; GenStage being the foundation library and Flow and Broadway at a higher level.
- samuell 6y agoOn a related note, there's also work on an FBP implementation in Elixir: https://github.com/pcmarks/ElixirFBP https://github.com/pcmarks/ElixirFBP
- didibus 6y agoWhat's curious is that CSP started with named ports as well, but evolved to become anonymous. > Programs in the original CSP were written as a parallel composition of a fixed number of sequential processes communicating with each other strictly through synchronous message-passing. In contrast to later versions of CSP, each process was assigned an explicit name, and the source or destination of a message was defined by specifying the name of the intended sending or receiving process I wonder what gives? Why this return to an older form?