I wrote about a library that Evadne Wu released last year which has escaped the attention of the Elixir community so far.
A post was merged into an existing topic: Blog Post: Elixir for JavaScript developers: first impressions
Resilience and Fault Tolerance are concepts that should be present in our everyday development approach. What happens if we mix that up with high concurrency? In this blog post, I wrote for Finiam, I share an insight into these topics and a simple Framework on how to do it.
Thatās a phenomenal article. Really makes setting up a supervision tree crystal clear. It makes me wonder if there is any sort of community ācookbookā where ārecipesā like that are shared, something like Rustās cookbook.
Thanks! Not that Iām aware ofā¦ Maybe there is, and weāre both missing out If you end up finding something about that, feel free to reach out!
nice article
Weāve recently found a nice use case for a mini DSL in our application and have published a blog post how we used macros to get consistent authorization.
Canāt Live with
It, Canāt Live with
out It!
'Withā is a powerful tool in Elixir, but itās not without its quirks. This blog will help you understand how to use it best and how to manage unexpected behaviours.
I recently rebuilt my website in Phoenix Elixir 1.6.5 and Iām thinking about doing a tutorial series on how I did it. What are your thoughts on a full nuts and bolt deep dive tutorial?
Bumblee & Stable Diffusion & Phoenix Live View meets in one place
Interview with Holden Oullette, the new maintainer of the Sobelow security scanner.
In this post, I talk about using handle_call
with noreply
inside a GenServer, and how it may come in handy for certain situations, like transforming asynchronous requests into synchronous ones (there are a few catches of course, so be sure to read until the end).
I think you have a bug there. Generally, you need to keep a lookup table in the GenServer for all outstanding requests, keyed of an opaque token and pass the token down to the async process so you can figure which request is from which client and reply accordingly. You only have a field from_pid
in the GenServer state, so concurrent clients are going to step on each otherās toe, the replies will get misdirected, and your clients will hang.
Hum, good point! But, I believe the answer is yes and no
In my use case (where I used this) I knew for sure that the given GenServer
was unique per user currently active in a specific part of the Web App, as pointed out in the Things to take into account part. This means there could be only one different caller in that situation, so the need to store only one pid
.
However, what you said is true if that isnāt the case, and the example code by itself can be a bit misleading. I updated the Things to take into account section to highlight this situation. (Timeouts, and other possible issues still need to be taken care of by the user).
Does it make sense and do you think itās more clear now?
Thanks for the comment!
If your GenServer will not see concurrent usage, why go through all the trouble for deferred replies? You can just use a receive loop to wait from the response in the GenServer.
To be honest, I didnāt think of that when applying this to my initial situation, and a receive do
feels like a better approach, even if for just readability purposesā¦ Still, my main goal with this post was just to show that this was possible to do and that it can help in specific situations, as itās something that may slip through when reading the docs, or just getting started.
āThere are tremendous opportunities for commercial Elixir libraries.ā
My latest blog post on how to use exponential backoff in Elixir to handle unreliable external services.
A post on how you can improve long time maintainability by decoupling external libraries.
Hereās one on handling subscriptions and payments with Gumroad. Iād say the concepts are broadly applicable but implementation examples are taken from my Elixir/Phoenix webapp.