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

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
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
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...
273 38985 115
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement