4 ms·
This is one of the things I love about Elixir and OTP+The Beam that underpin it all. It's really great that you can just slowly (as is sensible) move your syste
by andy_ppp 5y ago
This is one of the things I love about Elixir and OTP+The Beam that underpin it all. It's really great that you can just slowly (as is sensible) move your system over to message passing across many VMs (and machines) before you need to move to a more bespoke service oriented architecture.
With Umbrella apps this can already be setup from the start and you can break off bits of your app into new distinct message-able components (micro services you could say) as you like while still being able to share code/modules as needed.
The other thing I'd say is you can introspect how these "services" are running in realtime with IEX and it feels like magic being able to run functions in your application like some sort of realtime interactive debugger. One of the biggest issues I had with micro-services is figuring out what the hell is going wrong with them (in dev or prod) without the layers of extra work you need to add in terms of granular logging, service mesh and introspection etc.
- jeremyjh 5y agoCreating a lot of actors and messaging for the business logic of your application is considered an anti-pattern in Elixir, and a typical novice mistake. Applications in Elixir are structured using functions that are in modules that call other functions in other modules. Yes you can use OTP applications to isolate dependencies but none of this is done with the intent to more easily break up your app into a bunch of micro-services.
- ianbutler 5y agoRight but that's not really what they're saying, they're talking about Umbrella Apps, https://elixirschool.com/en/lessons/advanced/umbrella_projects https://elixirschool.com/en/lessons/advanced/umbrella_projec... Which is a distinct feature made for breaking up the logic of your applications into smaller, domain bounded libraries. Umbrella apps are for the most part like regular libraries, just internal to the project which let's you do neat things like share config and deployment across them. They don't require interacting with OTP functionality unless you make them that way and I think the OP was crossing some wires there.
- jeremyjh 5y agoYes I acknowledged OTP apps as a valid structure. An umbrella app is project that builds multiple OTP apps.
- ianbutler 5y agoNo, you do not even need OTP functionality on the child project, that's my point. Not everything uses OTP. Edit: We may be talking past each other, from Sasa Juric: "It’s worth noting that poison is a simple OTP app that doesn’t start any process. Such applications are called library applications." Which is what I'm thinking of. He also says "Finally, it’s worth mentioning that any project you build will mix will generate an OTP app." I was mainly talking about you don't have to use anything like GenServer or other OTP functionality with the split out app so they're more like the library application but that is still in fact an OTP application even if you're not using any of the downstream OTP features.
- jeremyjh 5y agoEach separate child project is still an OTP application, even if you do not use "OTP" features in them. OTP app is just the term for that artifact, similar to assembly or archive in other languages but it is not only terminology, each one will have `start` called when the VM starts, even if they don't spawn any servers.
- ianbutler 5y agoYup which I'm not sure if you replied before I finished my edit or not but I came to the same conclusion.