volroom
Absinthe Resolution Phase taking up majority of request time
Hello, we’ve been investigating the performance of one of our queries - basically it’s used to list products and categories like you’d see on an e-commerce site. On our dev environment it takes roughly 10s, and with tracing I can see that the first ~2 seconds are spent fetching the main body of data (DB queries etc). Then at the end Absinthe.Phase.Document.Execution.Resolution takes up around 6 to 7s and Absinthe.Phase.Document.Result takes around 500ms.
We’re a bit surprised that the bulk of the request time is spent resolving the fields - in order to check that our resolvers aren’t the problem, we moved all the processing and logic into the context function, so that the fields are just resolved by Map.get/2
Is it just expected for the resolution phase to take this long? It is a big query to be fair (if I prettify the response it takes up 87,056 lines)
Marked As Solved
benwilson512
3 megs is a TON of data to ship via GraphQL. Unlike just shipping regular JSON every return value is type checked against the schema, errors are tracked at the node level, and so on. While there are hypothetical optimizations I have wanted to do in the resolution phase they’d involve a level of refactor I just haven’t had time for to date.
Overall I’d find a way to maybe paginate products if that’s the big field or something.
Popular in Questions
Other popular topics
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
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









