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

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
perzanko
Do we have maintainer of absinthe-graphql/dataloader here? We have a PR that we’d like to merge to the library. Relatively small additive...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
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
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews