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

the actor model in Erlang and (recently!) in Pony implements something even better: explicit backpressure by deprioritizing senders to busy mailboxes. The model can do this because it includes the scheduler in its scope, which doesn't happen in CSP.



I, too, have a bit of experience with backpressure implementations in both Erlang and Pony. Erlang's "penalize the sender" doesn't work in many cases, so I'm not surprised that it's being removed. Erlang's remote distribution implementation & messaging semantics are Mostly Great but is definitely not Perfect.

1. Head-of-line blocking caused by congestion on the single TCP connection used for message transmission between any two Erlang nodes. This can cause major problems for apps control vs. data plane design, such as Riak and Lasp. Work on Partisan (https://github.com/lasp-lang/partisan) appears to be a substantial improvement.

2. If the single remote distribution TCP connection between two nodes is broken, then the first Erlang process to send a message to the remote node is, hrrm, well, borrowed/co-opted by the BEAM VM to connect the new TCP session. IIRC that process is marked unrunnable by the scheduler until the connection is set up or perhaps there's an error. If that process is really important to the functioning of your app, for example, an important system manager in the control plane of the app, then you have a very difficult-to-diagnose latency Heisenbug to cope with.

-Scott


'penalize the sender' has the benefit of being very clean; it doesn't work in >1 machine distributed cases, but then neither do go or pony yet. I'm surprised to discover that it's being removed. I wonder what the thinking is for the local case.


> it doesn't work in >1 machine distributed cases

More generally, it doesn’t work when you have multiple schedulers, which nowadays is true for nearly all Erlang systems.


This was never meant to be a complete solution to back pressure in Erlang and has recently been remove for the next major release: https://github.com/erlang/otp/commit/2e601a2efc19d64ed0628a5...

I’ve heard speculation that it really only helped scheduler efficiency and this didn’t apply all that well on SMP schedulers and has finally been removed since non-SMP builds are no longer supported.

As for Pony, their actor model doesn’t support selectively receiving messages so their queue handling may have some different trades to make there, as well as interaction with primitives like promises (which are used where Erlang would prefer a ref tagged receive clause). Spooneybarger has done work on backpressure in Pony so maybe he or other Wallaroo labs people can elaborate.


My reply would be that while both Pony and Erlang are actor model languages, the semantics are quite different.

I never speak of either being better than the other. Rather, they are different. I'm an expert on backpressure in Pony, not so much in Erlang, so I'll leave it at that.


I’m a fan of both approaches. As we can never it say too soon in life: tradeoffs.


Interesting. thanks for the info!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: