-
Notifications
You must be signed in to change notification settings - Fork 88
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
supergraph compose should not make a separate graphql query for each subgraph #1946
Comments
This is the query that is executed for each and every subgraph, in that parallel iterator:
|
Some additional context where these concerns were highlighted and discussed over two years ago but unfortunately the fundamental issue was not truly addressed in #992 and just masked (temporarily for us) by using the rayon threads.
|
Hey @theJC, thanks for raising this issue. We've been taking a look at this problem recently and think we have a couple solutions coming up that should address this problem. Firstly, we are looking at replacing the rayon implementation with a tokio-based implementation. In testing, we've been able to reduce a sample graph of 100 subgraphs from 1m15s down to 10-11s by leveraging a better concurrency implementation. We are also looking at a more efficient strategy for fetching subgraphs as part of We will need to do a bit of testing on the last one, just to make sure we're making the best use of our resources across the API and client. We expect to release the improvements around this in the next month. |
howdy, @theJC! #1995 is the branch removing rayon threads in favor of tokio if you'd like to keep tabs on it, and we're getting ready to release the |
#2001 adds batching to fetching subgraphs |
^ part of what will be the release including #1995; no hard dates yet, but getting closer |
Description
Rover supergraph compose loops and makes a graphql query SubgraphFetchQuery for each subgraph in the supergraph. For supergraphs that have significant number of subgraphs (we have 294 in QA, 277 in PROD), this can take quite a while and is not an efficient mechanism to retrieve the information needed -- and its a waste of the client's time and Apollo API server's resources.
Instead provide and use a query that takes an array input list of graphref & subgraph to retrieve, or retrieve all subgraphs for each graphref mentioned and reuse it. I am unsure in the value of using rayon threads to do this.
Steps to reproduce
Code is here:
rover/src/command/supergraph/resolve_config.rs
Lines 68 to 183 in 436a677
Expected result
For composing supergraphs that have approaching 300 subgraphs, this should take < 10 seconds, no matter how many cpu's a machine has.
Actual result
On our build runners that runs this, they have a single CPU available, therefore this takes almost 4 minutes to run. Additionally our pipelines that invoke supergraph compose fail often, some days more than 1/8 of attempts fail.
Depending on the number of CPUs available on the machine, the time that it takes to perform this step:
Environment
Ubuntu
Rover 0.23.0
bash
Studio plan: enterprise
installation method used by our pipelines: npx, but this has been reproduced locally on my mac laptop just using the rover binary.
The text was updated successfully, but these errors were encountered: