xrodriguez

xrodriguez

Project structure - Umbrella or Poncho approaches?

Hi everyone!
I’ve been in Elixir for 3 months and I want to develop a platform which has to support a lot of concurrent users (+50.000, by the moment). I’ve learned a lot about the language and some advises that the community shares constantly. But my main question appears when I think about the project structure. This platform will have a lot of modules, maybe about 10 (and not little ones, so perhaps I should split some of them), and some of them should use Phoenix (but not all of them).
I’ve searched about Umbrella structure and I think that I know more or less how it works. But also I’ve found that a lot of people does not recommend it when talking about production. Then I searched a little bit more and I found articles about the Poncho mindset, which isolates completely and works using the paths / repositories dependencies.
I’ve seen some topics talking about this, but they don’t really have a solid conclusion (there are still some Umbrella followers).
So my question would be: what is the best project structure when we talk about a platform of this size (thinking in future scalability), and if a Poncho structure would make it slower or faster?

Thanks a lot!!

Most Liked

LostKobrakai

LostKobrakai

I feel like arguing about plain mix projects and poncho or umbrella style projects is the wrong level.

In elixir you basically have two kinds of “structure”. Structure of code – which should be handled by modules and folders in your source code – and structure of runtime concerns, like dependencies or being able to run parts of your application independently from others – which is what drives how you set up supervision trees or multiple otp applications.

What’s often criticized with umbrellas is using the latter solution (otp applications) for the first reasoning. Don’t just put code in multiple otp applications if those parts of code are not meant to be run in isolation. A single otp application is just fine for that.

On the other hand if you intend to split up your application at runtime e.g. over multiple nodes then go for properly devided otp applications.

As for poncho vs. umbrella. Poncho style project setups are way more explicit especially when it comes to configuration. With umbrellas people often seem to have problems with the fact that config (just like dependencies) are set for the whole umbrella. With elixir 1.9 this is even enforced by the generators, which no longer generate application level config in umbrellas. For the nerves people where configuration is even more complex because of target machine differences the solution was to just not use umbrellas. Personally I feel like both are usable and you need to find what style of thinking about/working with your application suits you more. Either “one piece at a time” (poncho) or “the whole as the sum of all parts” (umbrella).

11
Post #2
hauleth

hauleth

IMHO there is almost no difference between these two approaches since 1.9 (and earlier the only difference in reality was handling the configuration). Right now I would go with Umbrellas even more, as it provides what I want almost directly OOTB and with Poncho I need to manage everything by myself or use external tools.

LostKobrakai

LostKobrakai

If you have incompatibilities you’ll have them with the poncho style project as well. At runtime things are run exactly the same. In umbrellas you’re just forced to spot those issues as you’ll always maintain just one set of configs / run apps together more often, while for poncho applications those things might be discovered later e.g. when switching to a “higher level” application. Both have their place though and it’s a tradeoff between more flexibility and tighter control.

Personally I feel like poncho style applications make the most sense in loosely coupled projects like nerves. There might be an application for talking to a special sensor and it just needs to be included to be called from elsewhere, but there are no other dependencies between applications. If things are more coupled, but e.g. in separate apps to split load or failures predictable between different nodes I’d rather opt for an umbrella.

Where Next?

Popular in Questions Top

Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
nobody
How to bind a phoenix app to a specific ip address? could not find anything about that, nowhere, unfortunately, but for me this is quite...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

We're in Beta

About us Mission Statement