5 ms·
The thing I find weird about Erlang's design is that actor mailboxes have no backpressure mechanism, which seems like a pretty big footgun. Go channels have the
by vore 3y ago
The thing I find weird about Erlang's design is that actor mailboxes have no backpressure mechanism, which seems like a pretty big footgun. Go channels have their own quirks, but requiring them to be bounded was a good design choice.
- littlestymaar 3y ago> Go channels have their own quirks, but requiring them to be bounded was a good design choice. Making it the default is a good design choice, but mandating them isn't: sometimes you don't want backpressure and buffering is what you want, and with no unbounded channel, you easily end up with being an unbounded amount of goroutines instead… (it happened to me once earlier this year)
- superb_dev 3y agoPonylang has backpressure for its actor's
- toast0 3y agoBEAM has some backpressure; it used to have more. If you send to a remote process, and the dist buffer is full, you'll be suspended. (Or you can send with no_suspend, and drop rather than suspend). When you send to a local process, you need to lock that processes's mailbox, which offers a little bit of backpressure if there's contention. Doesn't provide backpressure when the recipient process is just ignoring its mailbox, though. IIRC, earlier releases, maybe around r12-r16 would penalize processes that sent to a local process with a big mailbox, but I think that was removed because it didn't really work as envisioned, so better not to have the complexity. There's ways to build systems that are resilient to large mailboxes, but it's not necessarily simple.
- ghayes 3y agoAnd Elixir introduced GenStage to help with this [0]. The thing that I love about erlang's actor model over Go (that for me a fatal flaw with Go and CSP) is the "spooky action at a distance" issue. It's much easier to reason locally within an erlang project, in my opinion, versus a Golang project, since once a channel is created, it's often very difficult to trace its usage. [0] https://elixir-lang.org/blog/2016/07/14/announcing-genstage/ https://elixir-lang.org/blog/2016/07/14/announcing-genstage/
- fidotron 3y agoThe best effort I've seen to get around this is https://github.com/lpgauth/shackle https://github.com/lpgauth/shackle It was motivated by a need to eliminate OOM errors and supports large scale operation at very low latency.