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!
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.
with It, Can’t Live
'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
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
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.
Hi everyone, Paraxial.io now has guidance on how to fix each Sobelow finding. This documentation is also being published as open source, to benefit the Elixir community - Elixir Security: A Guide to Fixing Sobelow Findings
I recently wrote a post on Server-Side Request Forgery (SSRF) attacks, from the theory of the attack to a naive set of mitigations and finally an import of SafeURL. All code samples are in Elixir!