bsilva

bsilva

Communication between Elixir/Erlang services

Hello!

I want to improve my understanding of what’s possible to do into a clustered application and if I can send message around it in a natural way. And also which are the rules/good practices to consider when you move from standalone to a cluster environment.

For example purposes, let’s say that I have two different services:

Service A - Product service (Product’s attributes e.g: name, sku, manufacturer)
Service B - Pricing service (Stores product id + current price)

Those services were either written on Elixir or Erlang.

1 - Would be ok to add both of them into the same cluster? Is there any known problem or implication? What’s the ‘recommended way’ here?

2 - Could I replace completely the communication between then that happened via http with Erlang messages?

2.1 - If yes, how would it be possible? Is rpc suitable for this?
2.2 - How would load balancing work on that scenario? Should I write it or is it transparent?

Thanks :slight_smile:

Most Liked

lpil

lpil

Creator of Gleam

Hello! Welcome to the forum :slight_smile:

It’s perfectly valid to create a cluster containing nodes with different code loaded on it if you wish. :slight_smile:

Yes, this is definitely an option. If you are happy to always use Erlang based languages then a message based API can work well.

At very high throughput you may want to move from the default single TCP connection for inter-node messages to multiple connections. Depending on the skill-set and knowledge of your team is may be harder to implement than more mainstream HTTP APIs (but you’ll have had to implement much less API boilerplate up until this point).

I would advise against using the rpc module much, it uses a single gen server per node and this creates a big bottleneck. Your API should be regular messages sent to named processes.

You will need to implement load balancing for your message based API. There may be libraries that provide this sort of functionality, depending on what you want to do.

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36689 110
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42576 114
New

We're in Beta

About us Mission Statement