Replies: 1 comment
-
Ok I found out where it comes from, a coworker added a field resolver which is using a 3rd party api. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hello, there. Recently I noticed some weird response time on one of our service, which is using graphql-yoga (up-to-date):
And the implementation is mostly based on https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-fastify, nothing crazy.
Basically my problem is that the response time of the same query seem all over the place 50~150ms for consecutive calls.
Most are 50ms, but some queries are x2 or x3 slower for no apparent reason.
I suspected almost everything else related to networking (google cloud, fastify, prisma) first, but after putting few logs / tracing I realized, all this time seem to come from inside yoga:
Measure
So here is an example of this phenomenon, the same graphql query done twice in a row.
This endpoint simple return me data for a datatable (~20 rows and ~20kb raw response).
Query 1 (~59ms)
Query 2 (~183ms)
We can see in my setup, the time spent in parsing, building context or resolver times are quite small, stable and consistent.
But the time spent between the resolver ended and the json result passed to fastify handler seem quite long, most of the time it represent the majority of the endpoint duration.
And if I continue to refresh the same query, I can see timing all over the place
Question
I already tried few things like disabling all dev options
graphiql
& co, disabling every plugin, disabling cache, ... but absolutely no effect.Beta Was this translation helpful? Give feedback.
All reactions