Multiple apps and then a release to combine the apps.<br><br><div class="gmail_quote">On Sun, Oct 23, 2011 at 12:59 PM, Matthew Evans <span dir="ltr"><<a href="mailto:mattevans123@hotmail.com">mattevans123@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Hi List,<br>
<br>
I've often wondered what is the correct (as in idiomatic Erlang) way to structure an sufficiently complex service in Erlang?<br>
<br>
Obviously a simple service would be a single application, with a supervisor hierarchy something like:<br>
<br>
app_foo<br>
   |<br>
foo_sup<br>
   |<br>
gen_servers<br>
<br>
<br>
Let's suppose you have a complex service to deploy (that does related, but functionally separate tasks), what is normal:<br>
<br>
<br>
1) Separating the complexity as multiple apps (i.e. 2 .app files and beam files in separate ebin directories):<br>
<br>
app_foo               app_bar<br>
<br>
   |                     |<br>
<br>
foo_sup               bar_sup<br>
<br>
   |                     |<br>
<br>
gen_servers           gen_servers<br>
<br>
<br>
Or...<br>
<br>
<br>
2) A single app with multiple (hierarchical) supervisors (i.e. 1 .app file, all beam files in the same ebin directory):<br>
<br>
<br>
      app_foobar<br>
          |<br>
      foobar_sup<br>
          |<br>
   ---------------<br>
   |             |<br>
foo_sup       bar_sup<br>
   |             |<br>
  foo's         bar's  <br>
gen_servers  gen_servers<br>
<br>
<br>
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).<br>

<br>
Thanks<br>
<br>
Matt<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br>