Cluster singleton pattern

Wrote about how to safely run a globally unique process in an Elixir cluster, and a scary story from the past!

Learn about :global for registering unique processes in a cluster, and where using it can go horribly wrong. Or at least, a little bit wrong. And how to avoid weird edge cases. This was a lot of fun and nostalgic to write, hope you enjoy it

6 Likes

Nice article. It makes sense in retrospect, but I didn’t know you could handle global processes in the supervision tree by handling the already-started error and link+return the other pid. Cool trick :+1:

I think it would be worth mentioning Highlander in your article as well. It provides the same functionality as the SingletonManager proposed.

2 Likes

Just recently I came across your blog and I really like the posts! Have read some and the rest are archived in my Readeck. :open_book:

1 Like

Thank you for the story. Clustering in Elixir is easy to do but I know there might be some edge cases I can’t handle.

1 Like