[erlang-questions] Recommended Application Structure

Tristan Sloughter <>
Sun Oct 23 20:05:10 CEST 2011


Multiple apps and then a release to combine the apps.

On Sun, Oct 23, 2011 at 12:59 PM, Matthew Evans <>wrote:

>
> Hi List,
>
> I've often wondered what is the correct (as in idiomatic Erlang) way to
> structure an sufficiently complex service in Erlang?
>
> Obviously a simple service would be a single application, with a supervisor
> hierarchy something like:
>
> app_foo
>    |
> foo_sup
>    |
> gen_servers
>
>
> Let's suppose you have a complex service to deploy (that does related, but
> functionally separate tasks), what is normal:
>
>
> 1) Separating the complexity as multiple apps (i.e. 2 .app files and beam
> files in separate ebin directories):
>
> app_foo               app_bar
>
>    |                     |
>
> foo_sup               bar_sup
>
>    |                     |
>
> gen_servers           gen_servers
>
>
> Or...
>
>
> 2) A single app with multiple (hierarchical) supervisors (i.e. 1 .app file,
> all beam files in the same ebin directory):
>
>
>       app_foobar
>           |
>       foobar_sup
>           |
>    ---------------
>    |             |
> foo_sup       bar_sup
>    |             |
>   foo's         bar's
> gen_servers  gen_servers
>
>
> Seems like the preference is towards example 2; but to me this means that
> you can't easily decompose and separate functionality apart. It also means
> that messaging can jump across supervisors making for somewhat messy
> interfaces (plus having to cross supervise/link gen_servers that are
> separated by different supervisors).
>
> Thanks
>
> Matt
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111023/34206e43/attachment.html>


More information about the erlang-questions mailing list