smanza

smanza

Hello.

I am developing an application which include P2P services. Each service is using tcp server/client . And I am interested to use GraphQL specially Absinthe for the inter service or inter node communication . Many of P2P are using RPC but I want to leverage the concept of graphql around the query aggregation and field projection to reduce bandwidth and increase throughput.

My first idea was to use ETF with field projection but it seems a bit verbose, non standardised.
Exemple: {:my_method, [param1: val], [:field1, field2: [:field3]]).

So graphql seems good for that.
Unfortunately often services communicate over rest or rpc but graphql endpoints are often on the external client side but not really inside.

Do you have ant thoughts about using GraphQl as internal service communication ?

Showing Posts 16 to 7

smanza

smanza OP

From the benchmarks I have done with protobuf, flat buffer, avro, msgpack, thrift, cbor and etf, for encoding/decoding, Etf is really fast , I think this is due to the free serialization of erlang term in the BEAM. But for the size of the binary data, protobuf seems to be the best.

OvermindDL1

OvermindDL1

That’s not always the case, term_to_binary and vice-versa are not made for speed, consequently there are a number of encoders for the BEAM that are actually quite a bit faster than it (although it’s all so fast anyway that it doesn’t really matter in most cases)

smanza

smanza OP

Thanks for the video. Really interesting.
Asynchronous mechanisms in distributed system or microservices it’s a good way.
But I’m trying again to understand the concept and how it could be managed over a network.
If you have some examples or code using this concept I would be interested. :slight_smile:

And I’m struggled why some many big companies Google, Facebook, etc.. are using a lot of RPC’s style internally while message passing seems better .

Because at the end recent RPC solution such as gRPC, Thrift, Avro, etc.. are kind of RPC over messaging. Code does not call remote method as local method but kind of wrapper around a use case. But publishing as method over an IDL RPC interface.

hauleth

hauleth

Use message passing, like Erlang does instead of RPC systems that try to simulate that calling external function is the same as local call. Just watch this:

smanza

smanza OP

Looking at Ernie.
Do you have an idea why the repository mentions that?

Authors of this document believes that RPC are bad, and you should not use them. Instead use message passing between your services.

And what message passing between your services means otherwise ?

hauleth

hauleth

Cookies aren’t security feature, you can use distribution over SSL and you do not need to use EPMD if you do not want. Additionally you can always use solutions like Linkerd, Envoy, or Consul Connect for creating secure service mesh.

ityonemo

ityonemo

Is it better to use distribution, or to send a erlang term over ssl using term_to_binary?

dimitarvp

dimitarvp

I’d still recommend FlatBuffers, check it out. There’s a really good Elixir library, too.

The transport could be anything. I’d choose QUIC but there are still no Erlang/Elixir libraries. HTTP/2 or gRPC should be more than adequate for a while.

If you are looking for something P2P-like, I recommend checking out Phoenix.Presence.

smanza

smanza OP

Yes I do want to be dependant of the transport, because this layer may evolve for example: TCP,UDP, QUIC,SCPT, WebRTC,etc.. And the data and format exchanged should remains the same to ensure compatiblity.

smanza

smanza OP

Indeed I’m not using the BERT or Ernie specification but using ETF with :erlang.term_to_binary to encode freely any term in a binary format without involving any dependencies which come almost for free.
Even if protobuf or Cap’nProto produces a smaller encoded data, Erlang Term Format is definitevely the fastest data encoding on Erlang/Elixir and do not require to generate code.

Does the C nodes helps to avoid the erlang distribution via cookie and capable to be in an unsafe network support ?

Where Next? Top

Trending in Discussions Top

cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
axelson
Hi there! :wave: @frigidcode and I (but mostly him) have been running an Elixir Book club, we’re almost done with Designing Elixir Syste...
New
achempion
I’ve been using Emacs as my main code editor for more than a two years. It’s a custom build version although I’ve tried doom emacs and sp...
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
jtormey
Lately I’ve been thinking about how to organize components as a LiveView application grows. One of the pain points I’ve found (for myself...
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...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews