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

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
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New

We're in Beta

About us Mission Statement