GuSuku
I am new to Elixir and looking to run my distributed application (a state machine) on an elastic cluster. I want to know:
(a) If it is possible to migrate a process from one node to another, without losing the state of the actor or its messages (those in inbox and the one that is being processed).
(b) Are there good resources to follow or actively maintained libraries that I can look up for this purpose?
Some reasons when I would want to migrate could be when there is a severe imbalance in the load across nodes in the cluster (say, a new node got added to the elastic cluster) or when the application gets a notification that a particular node is about to go down.
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex










Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
idi527
You might want to check out erleans and/or horde.
tty
In migrating there are 3 things you need to consider:
Process state
You can place the state into a
structormapand have the new SMstart_linkwith this state this would solve this issue.Registered name
Either use
globalor have an internal name/process resolver to ensure current processes can still access the migrated SM.Message in queue
This is a bit trickier. Before migrating you will have to dequeue the messages into a list and provide it to the new SM.
This is a common trick to always dequeue messages into an
etstable and process off the table. This trick is typically uses for high transaction processes or for message reordering.tristan
I haven’t worked on erleans in a while (the company I developed it at is no more) but would like to again and to create an Elixir example or interface if it makes sense to offer some nicer abstractions when using in Elixir. And I suppose an ecto hookup for persistence would be good to do.
So it isn’t production ready but happy to help if anyone tries it out.
GuSuku
Thanks @idi527 (and @tristan !) - I will check out those libs
Thanks @tty. I will keep those in mind when evaluating solutions. On persisting messages: Is this the case only for inter-node migrations or is this pattern to be followed even when the process is restarted on the same node?
tty
This technique can also be used to restart on the same node if it is important to retain those messages.
A comparable technique is to store state in Mnesia for node restart persistence (and distribution). When a process is started it checks Mnesia if there is a last state stored and spins up with that state. By relying on the distributed properties of Mnesia this process is now node agnostic.
tristan
I wouldn’t use mnesia for distribution unless you have a very controlled environment (i.e. not the cloud).
amnu3387
could you explain a bit on why
?
tristan
Mnesia just was not built for such an environment where instances and the network are coming and going. I’m sure someone who has had the fun of attempting this would have better details than I can provide. The best I can do is link to Jesper’s post about it https://medium.com/@jlouis666/mnesia-and-cap-d2673a92850 which has some of the history behind Mnesia.
There are libraries to improve the situation, like Ulf’s
unsplitwhich he discusses in this erlang-questions thread unsplit - resolving mnesia inconsistenciestty
I use
mnesiabecause it comes with Erlang/Elixir. Substituting DynamoDB, or a RDMS is also possible. Might need to doterm_to_binaryand store a blob, however still very doable.