Nicolas
API call between two aps
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.
Most Liked
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.
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.
lud
You can adopt a modular desing inside a single OTP application. What problem are you trying to solve with microservices?
I guess this would require having GenServer for handling API calls.
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #code-sync
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








