smanza

smanza

Bounded queue, Semaphore, GenStage relationship

Hello .

I’m analyzing the concurrency principles for the Erlang processes and their mailbox.
So I know each message is processed one by one which seems a bit like a mutex in the concurrency language.

However there are some limitation regarding the maximum size of the mailbox and its message queue.

I found an article and lib proposed by Discord using semaphore to ensure the non overloading of the mailbox queue. Which seems like back pressure for Erlang processes . So this would mean to implement for each GenServer message an update of a counter using atomic updates and from the client verifying if there are some space for it.

But I know this concept of backpressure is already managed by GenStage , so a consumer is not overloaded by a list of messages. Nevertheless, from a producer perspective, it will be possible to overflow some pushed events and the GenStage mailbox and internal queue. This may causes event dropping.

So do you know if GenStage manages this ? Should we using semaphore concept to protect processes ? Or maybe using pooling to resolve this issue ?

Thanks

Where Next?

Popular in Questions Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement