beltrewilton
Seeking thoughts on the design of my umbrella project: Multinode WhatsApp Gateway and Bot App
Hey fellow devs,
This is my first post in this awesome community, and I’m excited to share my project with you all. As a newbie, I’d love to get your feedback on my design.
Here’s the context: I have an umbrella project with two apps. The first app is a gateway that receives a high volume of messages from Meta’s WhatsApp Cloud API. These messages are destined for different business account numbers (in Meta’s jargon). To simplify, imagine receiving messages like {"1800555", "message 1 from whatsapp consumer"}, {"18007777", "message 2 from another whatsapp consumer"}, and so on.
The second app is a bot that processes these messages. Now, here’s how my architecture works: the gateway (a Plug endpoint) is a node called gateway_node@127.0.0.1. When a message arrives, it reads from Mnesia, which has a map of business accounts to destination nodes. The destination node is a copy of the bot app (app 2), which can be something like customer_services_node@127.0.0.1 or another_company@127.0.0.1.
The advantage of this setup is that I can add nodes (business accounts) on demand without affecting the others.
So, what do you think? Is this approach too newbie-ish? Any recommendations?
Thanks in advance!
First Post!
al2o3cr
Node-per-tenant is somewhat unusual; more commonly you’d a setup where a DynamicSupervisor on a single node manages one tree of processes per bot, roughly like:
This lets all the instances of Bot share the rest of the BEAM support machinery, versus having separate copies in each client’s node.
This may not be possible if instances of Bot need a lot of resources - for instance, if you’re running LLM inference on a GPU in them - in which case splitting onto different physical nodes may be the only option.
Most Liked
BartOtten
Last Post!
AnaisW
I’m curious whether you’ve tested how Mnesia behaves under heavy concurrent bot traffic across nodes. I’ve seen some folks switch to ETS plus a lightweight sync process because Mnesia got chatty in clustered setups. Did you run into anything like that, or does your layout keep the load balanced well enough?
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
- #code-sync
- #javascript
- #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
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










