new syntax - a provocation
Wed Oct 1 08:41:36 CEST 2003
Luke Gorrie wrote:
[On moving processes across nodes]
> The tricky part seems to be moving the identity. Is there a simple way
> to do this that would be generally useful?
Basically, the processes need an identity that's independent of the node
they are running on.
One could do this statistically (generate a random 128-bit string for
each process and assume that a collision is less probable than any
combination of hardware failures that would produce a collision as well).
Or the current id could include the node id and a serial number, but
indicating nothing more than "place of birth"; the message handling code
would keep a table that indicated which process id lives on what node.
This is a bit complicated because such a table would have to be updated
lazily (to avoid O(N*M) overhead for N nodes and M processes, which is
generally O(N^2); making it lazy reduces the overhead to O(C log C),
where C is the number of connections actually made).
> If not, I'm more inclined
> to just write some code to kill the process on one node and start the
> new one on the other by hand.
The interesting part is how to tell all the clients of the original
process where the new process lives.
Other than that, I think restarting the process in the new location is
Another issue would be long-running processes. Stuff that doesn't fit
the Erlang model of "each server processes no more than a small chunk of
work with every message". Say, a day-long weather forecast that may have
to move to another server to avoid imminent shutdown, or similar stuff.
Another perspective: In Erlang, the programmer is urged to divide the
task into small subtasks. The approach of migrating the entire process
state allows programmers to keep the large monolithic tasks, opening up
another niche of design space.
In other words: I don't think that this is very useful for Erlang in its
current state, and it's not likely that this will ever change, but
it's an interesting and useful idea in other contexts.
Just my 2c.
More information about the erlang-questions