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

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
RemyXRenard
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
samoloth
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

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews