[erlang-questions] Dependencies, included applications and supervision

Jay Nelson jay@REDACTED
Thu Jun 26 01:14:57 CEST 2014


On Jun 25, 2014, at 3:52 PM, Fred Hebert <mononcqc@REDACTED> wrote:

> 
> What happens if the server fails repeatedly then? Does it crash the
> node, but only after another cycle of crashing everything?
> 
> If your app is designed as:

There may be better alternatives to what we have done (we have tried
lesser alternatives in the past and would welcome a better approach),
but the current approach involves essentially three elements:

  1) ets table of services
  2) some application supervisor hierarchy for the service
  3) advertising that the service is available

This sequence is enforced in a rest_for_one pattern, so that if the service
advertising or the implementation of the service becomes unavailable, then
the service will read as offline. Once rest_for_one has restored everything,
the last step advertises that the service is available.

The ets table is created and owned by the first supervisor so that it is not
lost during transient failure of other components. This is essential because
the ets holds other services advertised by other nodes and is consulted
locally.

In reality, the included_application ‘presence_server’ is essentially a library
with some convenient supervisors that we plug into the node’s hierarchy
because the service behaviour has to be plugged in between the ets and
the advertising capabilities, so a variant from the typical inclusion of one
root supervisor.

The “lesser alternatives” I referred to resulted in situations where the
presence subsystem went away but the service was available and running
just fine, but not receiving traffic because it appeared to be offline.

jay




More information about the erlang-questions mailing list