thamurath

thamurath

I am new to Elixir and was wondering how to deploy a distributed and load balanced system.

I mean:
I have in mind a service based architecture, so to say, where each app offers a service the the system.
There could be any number of nodes, and each of them could execute any number of applications, at least one of them.

I have been reading about libcluster, and seems to be the way to achieve automatic node connection, but:

  • How to discover wich apps is running the new connected node?
  • How to balance the load between them?

I have read a little bit abouf erlang :pool but I do not figure how to use it…

Any tips or documentation links to read would be very much appreciated.

Showing Posts 1 to 8

kokolegorille

kokolegorille

You might want to use libcluster with swarm, from the same author.

ityonemo

ityonemo

What exactly are you trying to do? The architecture will depend on what your ultimate goal

thamurath

thamurath OP

I came from a Service Based Architecture mindset, so maybe I am approaching this in the wrong way, but I was thinking on a system build by different Elixir apps that would provide different services.
Given a cluster of elixir nodes each app could be executed on any of those nodes.
When more resources are needed new nodes will be added to that cluster, manually or automatically, and tha apps running on those new nodes should be added to the existing ones and the load balanced between them to handle the increased traffic in the application.

That’s more or less what I was thinking. Seems to me that libcluster could help with the automagic discovery of new nodes, but do not know about the loadbalance part

kokolegorille

kokolegorille

You should also check Phoenix Pubsub, as standalone… It includes tools from now obsolete Firenest.

Also I am not sure it is a good idea to apply service based architecture concept to the BEAM, because it does not really work that way. Already one node is composed of multiple “micro services”, as any process could provide a service.

Rainer

Rainer

Have you thought about using a message broker instead of doing everything by yourself?
For this kind of distributed system I’d use RabbitMQ (which is written in erlang)

ityonemo

ityonemo

There’s something about the way that you posted this suggestion that bugged me. I have only been in prod for a short time, so I don’t really know, but I guess my gut feeling is you shouldn’t cluster everything and spawn up services dynamically inside your erlang cluster, just because you can. Maybe I’ve drunk the cool-aid, but one of the core philosophies behind BEAM systems is to give you the ability to reason about and manipulate failure domains. If you merge everything into a flat service mesh, you will lose that, and potentially lose control if by chance you wind up with a bunch of cpu heavy processes on the left side of the mesh and a bunch of io heavy processes on the right side of the mesh. Also, realistically to do what you want to do, you’ll need to organize your code into a single giant monorepo, which may not be what you want.

I think typically what you should do is group your services into “services which ought to come up and down together”, or “services which need security isolation” and use “non-erlang-distribution” methods to pass information between those services.

thamurath

thamurath OP

As I said maybe I am approaching this from the wrong point ( I have been looking for books regarding design best practices in Erlang but I have found no one yet) .

I was thinking that a node could be running a bunch of different “services” (apps) instances depending on the release type installed on it, that way I could add more app instances when necessary … the problems are:

  • How to know which apps are running in the new node
  • How to balance load to include the new apps instances running in the new node.
thamurath

thamurath OP

I am pretty new to Erlang/Elixir and I still trying to learn and understand the design best practices for this platform, so maybe I am totally wrong …

The failure domains concept you mention seems very interesting. Where could I read something more about those core design philosofies? I am really interested.

Regarding the big mono repo … well I am currently working on a multi-repo micro service solution and … it is a nightmare. In my experience so much repos add too much complexity without any reward …but that´s another story.

Thanks for your time and your answers …

— All posts loaded —

Where Next? Top

Trending in Questions Top

Hellowman
Hello everyone! I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++. Does anyone ...
New
yarrichar
I’m very new to Elixir, so sorry if this is a silly question: I am wondering what happens to the mailbox of a process when the machine i...
New
pragdave
How do I tell Hologram not to escape HTML when substituting into templates? {Textile.render(@product.long_description)} escapes the HTM...
New
Fl4m3Ph03n1x
Background When trying to execute mix release on a Windows 11 machine for a Phoenix project I get the following error: * assembling mark...
New
mandar1045
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
rlipscombe
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
saleyn
Is there a way to import record definitions in the iex shell for pretty printing (similar to the rr command in the erl shell)? This woul...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
261 13183 112
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
charlenopires
Hi everyone :waving_hand: I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews