Cost of running multiple Phoenix apps?

In his Coding Gnomes video course, “Elixir for Programmers”, Dave Thomas contends that it makes sense to have a separate Phoenix app for each type of connection (eg, HTTP, Channel). This appeals to me, from the point of view of cohesion, modularity, simplicity, etc.

However, I’m a bit concerned about the impact of having multiple copies of the Phoenix support code. One issue has to do with file storage: each copy will take up thousands of directories and files. Assuming that all of the copies are stored in the same Git repo, their blobs will be shared. So, that’s a minimum of three copies of the support code, adding a lot of bulk and complexity.

I also wonder whether this approach would affect the memory footprint. How much of the Phoenix support code would be shared in the running image? In summary, what issues are involved in running multiple copies of Phoenix?

-r

1 Like

You can have separate phoenix apps running in the same BEAM VM for note. :slight_smile:

3 Likes

There’s only one copy of each module loaded into each BEAM instance, so you have no runtime penalty from that. Disk space is the main issue, but not something I’d be too worried about.

I know Dave advocates for poncho-style path dependencies rather than an umbrella app. You’ll have less disk usage with an umbrella, but still, I wouldn’t expect that to be a deciding factor.

4 Likes

Wouldn‘t a release put all dependencies in a single folder preventing duplicate files anyways? So disk space would only be a local issue.

2 Likes