18 ms·
If I understand this right, this is basically the Erlang/Elixir OTP programming model, but across microservices rather than across a single (potentially distrib
by rkangel 4y ago
If I understand this right, this is basically the Erlang/Elixir OTP programming model, but across microservices rather than across a single (potentially distributed) VM. To be clear - that is a good thing.
One of the core concepts of OTP (effectively the Erlang standard library) is the GenServer. A GenServer processes incoming messages, mutates state if appropriate and sends responses. The OTP machinery means that this "send a message and wait for a response" is just a straight function call with return value to the caller. OTP takes care of all the edge cases (like when the process at the other end goes away half way through). This means that your code is just a straight series of synchronous function calls, which may be sending messages underneath to do things or get data, but you don't have to care. It's a lovely system to work in, and makes complicated systems feel simple.
The elements communicating are in Erlang terminology 'processes' - but not OS processes, they are instead lightweight userspace schduled things - very lightweight to create. Erlang has built in distribution that allows you to connect multiple running machines, and then the same message passing works across network boundaries. You're still limited to the BEAM VM though. This is the 'full' microservice version of that.
- stolsvik 4y agoThanks, I'll take that Erlang-comparison as praise! (I actually mention the actor model as inspiration here: https://mats3.io/background/what-is-mats/#attempt-at-a-condensed-explanation https://mats3.io/background/what-is-mats/#attempt-at-a-conde...)
- fy20 4y agoI'm pretty sure there should be a meme here, that any new async messaging system ends up reinventing Erlang/OTP.
- stolsvik 4y agoThere is: https://news.ycombinator.com/item?id=34767858 https://news.ycombinator.com/item?id=34767858