# Christopher Meiklejohn

home partisan lasp research courses publications videos code curriculum vitae

## Riak PG: Pruning terminated processes

28 Jun 2013

In my previous post, I discussed the implementation of a distributed process group registry, called Riak PG. This post continues that thread and discusses the problem of process monitors across partitions.

As previously discussed, Riak PG stores copies of the process group on a number of replicas within a cluster of Erlang nodes. However, this increases the complexity of pruning that process list when those processes are terminated. More specifically, processes running on one side of a partition have all of their replicas located on the opposite side of a partition, so process monitors are useless in determining when that process should be removed from the process list.

One strategy for resolving this is to involve an extra node in the coordination of requests, an additional replica running where that process is running. This vnode can then monitor the local process for changes in that particular processes state, and update it’s local replica accordingly. However, this solution is problematic if this node completely fails. If the node completely fails, not only does that replica become unavailable, but due to it’s replica being unavailable, that update never propogates.

One alternative strategy is to prune the process listing during the read repair process based only on known information about terminated processes.

First, we modify the coordinating finite state machine to, once replicas have been merged, prune known terminated processes on available nodes.

For instance, the modification to the read-repair process:

First, we determine if a process identifier should be pruned or not, and call to the observed-removed set to remove it. We use an arbitrary atom, none, because the value isn’t used in the implementation of the set.

To determine if processes should be pruned, we only prune when the node hosting the process id is available, but the process is no longer alive.

Qed.