aloukissas
When doing a publish call, should we expect the performance behavior to be similar to PubSub.broadcast/4 (i.e. almost instant)? Reading through the Absinthe code, it looks like that perhaps the run_docset call may be expensive.
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
Hi @aloukissas
publishis indeed expensive by design, it is not instant likebroadcast. Unlikebroadcastwhich merely needs to send a message to various processes, Absinthe needs to execute the documents associated with a topic before it can send results to end users. So some process somewhere needs to bear the cost of performing this execution.By default, that is the process that triggers the
publishcall, generally a mutation. This operates as a form of back pressure, where load incurred by an operation on the system is felt by the request that triggers that load.aloukissas
Thanks for confirming Ben!
aloukissas
Should we expect to see better performance on the mutation if instead of doing out-of-band call to
publish, we use thetriggerfunctionality like in the example in the docs?benwilson512
No trigger just runs the
publishcall inside of middleware on the mutation same as callingpublish. You can spawn a task and callpublishinside the task, or (better) you could build like an oban job queue of publish calls perhaps. The main danger to just spawning tasks is that you overload and potentially even OOM the system if you have many subscribers and many mutations on those subscribers without any backpressure.aloukissas
Following up here: we are noticing that
Absinthe.Subscription.Local.publish_mutation/3can often be very spiky wrt latency, sometimes hitting > 1 second. The resolvers involved are instantaneous: they use the provided payload and optionally Nebulex in-memory cache (in the microseconds).Here’s the interesting part: we see huge gaps in the traces between when the
publish_mutationis called until the resolvers are called (i.e. when the[:absinthe, :subscription, :publish, :start]and[:absinthe, :subscription, :publish, :stop]telemetry events are emitted. This span can e.g. take 50 msec yet the entirepublish/3span can take 10-20x that, in unaccounted for time.If I’m reading the code correctly, the code below is what’s run before (gh link):
This calls
Registrymodule underneath.. I wonder if under pressure this can have performance issues?hubertlepicki
@aloukissas not sure if this is applicable in your case, or you can make it applicable, but I found a tremendous performance improvement after deduplication subscription resolvers Understanding Subscriptions — absinthe v1.11.0
Subscriptions by default are expensive because they have to be resolved in context of each connected user. You can pass a context to it and make it resolve only once.
That not always can be applied, obviously if different users should see different data it often can’t work.
aloukissas
I learned this the hard way when I first started using Absinthe with subs. Dedup should be the default, things don’t really work at all without it.
hubertlepicki
That’s a broader topic about GraphQL in general and subscriptions share the same possible negative implications for performance as the protocol in general.
I kinda use them as a pubsub mechanism these days, and use it to notify that something changed rather than sending the big payload in subscription. That helps too, especially if the client then can batch up debounce their own API calls to fetch the updated data.
If you keep the subscriptions simple, and keep the Graph tree flat / two levels max with no loops, GraphQL is pretty nice.
aloukissas
TBH, using subs as a signaling system is wrong. There is something in absinthe subscriptions that does not work well under load. We’ve forked it and added a ton more instrumentation to help us identify these.
gabrielpra
Hey @aloukissas! Did you find anything useful through your instrumentation?
I have found this comment about context size that could be relevant, but haven’t started digging too deep yet: Absinthe cannot seem to handle even 1000 concurrent subscriptions - #2 by josevalim