smanza

smanza

GraphQL for inter-service communication

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 ?

Most Liked

dimitarvp

dimitarvp

GraphQL is, in my eyes, good for everything else except internal communication. You also don’t get any field protection; in your normal Absinthe configuration (and I suspect that of many other libraries) you can poll whichever field as long as it’s actually a part of your persistence schema (the DB).

GraphQL is also notoriously bad when it comes to caching endpoints. It’s doable but plain old REST endpoints are times easier to cache by proxies, relieving stress off of your servers (if you put them behind something like Cloudflare or dedicated Squid/Varnish proxy machines).

An argument can be made that GraphQL is more ergonomic and intuitive than many others and I’ll immediately agree if you raise that point. But in terms of technical complexity to integrate + maintain + the cost-benefit in your intended use-case… I’d say it’s a fairly risky choice.

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:

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)

Last Post!

smanza

smanza

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.

Where Next?

Popular in Discussions Top

CharlesO
Erlang :list.nth simple, but 1 - based nth(1, [H|_]) -> H; nth(N, [_|T]) when N > 1 -> nth(N - 1, T). Elixir Enum.at … coo...
New
mbenatti
Following https://github.com/tbrand/which_is_the_fastest |> https://raw.githubusercontent.com/tbrand/which_is_the_fastest/master/imgs...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
Fl4m3Ph03n1x
Background This question comes mainly from my ignorance. Today is Black Friday, one of my favorite days of the year to buy books. One boo...
New
mmmrrr
Just saw that dhh announced https://hotwire.dev/ Is it just me or is this essentially live view? :smiley: Although I like the “iFrame-e...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 131117 1222
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
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
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement