Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


And 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/


BEAM 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.


The best effort I've seen to get around this is https://github.com/lpgauth/shackle

It was motivated by a need to eliminate OOM errors and supports large scale operation at very low latency.


> 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)


Ponylang has backpressure for its actor's




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: