Nicolas
Hi,
I’m building an app which I try to architecure as modular, inspired by microservices. The idea is to have one elixir appliciation for each bounded context. The question then is how to implement communication between application, like API calls.
I can implement a HTTP/JSON API facade for each service or I was thinking using clustering and call through application nodes. I guess this would require having GenServer for handling API calls.
Do you have any experience in such architectures and/or advices ?
Thanks.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 7- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
D4no0
If you want to use OTP inter-node communication then this is as simple as using libcluster and erpc. There are few gotchas here and there so I would recommend to read the documentation very well if you plan on using it in production.
My only recommendation in this regard is to scale the application vertically as much as you can, since that will save you a great amount of trouble and OTP scales much better vertically than most of runtimes out there.
lud
You can adopt a modular desing inside a single OTP application. What problem are you trying to solve with microservices?
If each app has a single GenServer process that does the calls to the other apps you are introducing a nasty bottleneck from the get go. I would not do that uless I have a specific reason to.
Nicolas
I’m specifically tied to microservice, but interested in how to make modular application in OTP. Modular for me, means at deployment time: being able to enable/disable components (Applications, supervisor, … ?). Then several nodes could form a whole cluster allowing application components to be distributed.
For example: one node running business bounded context (repo, Ash, …) . On another node a phoenix web app querying de businees app through cluster.
Does it makes sense ?
LostKobrakai
So pure curiosity?
Architectures like that can be done indeed, but I’d argue that one shouldn’t go there unless there’s a good operational reason for it. E.g. with recent interest in ML/AI in the community there’s a good reason to move that kind of work to a (small) set fo beefy machines with GPU, because having all webservers be such is expensive. This however is not a tool for domain or code organization.
dimitarvp
If you really decide to go forward with this: in terms of network, go for HTTP/2 + gRPC if possible (haven’t checked Elixir support but should be fine?). Less overhead in general.
Outside of that, go for simple tokens that expire in 15 - 60 minutes and have a background worker refresh them some 10-30 seconds before they expire. That works quite fine, I’ve done it.
…but in general I’ll echo other posters: don’t splatter your Elixir code in multiple apps if you can help it. One mega server will work much better.
dimitarvp
That’s easily doable via env vars or whatever other configuration mechanism you prefer. Your application can just optionally start / not start certain parts of itself depending on them. In fact many projects already do this with dev / test environments: test env does not start most of its runtime dependencies.
zachdaniel
I think in order to advise on this kind of thing, I’d need to know why you want one elixir application per bounded context. And then I’d suggest inverting the question, and asking yourself what parts of your application needs the benefits that you’re looking for, and then apply the solution just to those parts.
For example:
I have an image processing pipeline that needs to be deployable independently so that it can be horizontally scaled independently. Therefore, I will create an application to manage the processes and state that are used to accomplish this.
I would not suggest choosing a design pattern for “all bounded contexts”. It may sound simpler, because you now have a one-to-one mapping between concepts (i.e bounded context == application), but it will also push you towards a place where you have a bunch of extra boundaries/state that serve no purpose.
So using the image processing example (and using Ash as frame of reference), I’d have all of my application logic in a single application(i.e shipped to all nodes of a cluster), but would have the resource(s) for processing an image call into some image processing service code, that perhaps runs only on certain nodes of the cluster, or on some other heterogenous nodes. That code would be just “regular elixir code”.