-
-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
performance issues due to breadth first execution of grapqhl queries in case of async resolvers during calls burst #200
Comments
Hi @alessandrolulli. Can you check whether the @defer/@stream functionality of GraphQL.js 17.0.0a2 which is already contained in the main branch of GraphQL-core would solve your problem? |
Note that the @defer/@stream functionality of GraphQL.js 17.0.0a2 is now included in GraphQL-core 3.3.0a3. |
Hi, sorry for not answering on this. Unfortunately, our architecture can not support defer/stream. We need to load all the data at once. Moreover, the problem is still present. Further analysis shows that the garbage collector trigger many many times, but additional analysis is required. We still experience very slow query response time in large nested schemas and this is particularly evident in query call burst |
just to give you an idea of our application, the following are the most impactful functions in our app due to graphql:
|
When we receive calls burst we found that the calls "wait each other" (i.e. the first call of the burst waits the last one).
This result in degradation of performances in both time of execution and memory consumption in the server because we have to keep many calls in fly.
This is particularly evident in big graphql queries where the users request many fields and we have several depth in the queries where each level has many async fields.
Just to be TLDR, looking the implementations of graphql and asyncio we understood that this is due to the following:
As an example lets have queries like that, where data may be like beer vendors and we want for each beer vendor many fields that describes that vendor, a1...a100, b1...b100, ...:
If we have n of this calls coming in burst when we arrive to the depth of the c fields we have many many task scheduled in the asyncio queue.
If we check the of order of execution we have that the first query, on each level, "waits" the other queries, because all the queries schedules a lot of tasks.
In the proof of concept, that you may find at the end of the post, you can verify the order of execution of the resolvers.
It could be very nice to have some sort of priority in the order to let the first query not wait the scheduling and resolve of all the queries before ending.
I understand that this is something between graphql and asyncio but i think it could affect the use of graphql in environments receiving many calls.
Fixes, helps and hints in how to improve this would be very appreciated.
The text was updated successfully, but these errors were encountered: