graphql-engine
graphql-engine copied to clipboard
Sequential call to remote schema with multiple root on Query
I have currently upgraded to v2 and now a query with mutiple roots are getting send each separatelly and sequencial to my remote schema.
Example query:
query {
users(limit: 1) {
id
}
retailers(limit: 1) {
id
}
}
Before v2, my remote schema received one connection with the query, now with v2 the server receive 2 connections with a single query like:
First connection:
query {
users(limit: 1) {
id
}
}
Second connection:
query {
retailers(limit: 1) {
id
}
}
Is there any way to prevent that?
Depending on the original query, I get a timeout from Heroku because the following requests are sequencial and wait the previous response.
We are using apollo and datasources and this change make the request slow as an single query can share dataSource cache and with split one can not.
I have the same problem. @rodrigorm did you find a way to change the behaviour so the remote schema resolvers are executed concurrently?
For my problem it's a slightly different query. Remote schemas that are joined into the graph using remote schema relationships.
eg:
query {
account {
status # this is a DB field
settings { # this is a remote schema relationship
account_owners {
name
}
}
balances { # this is a remote schema relationship
balance
}
#... plus more remote schema relationships related to my account type
}
}
this performs really poorly because the remote schema relationships are executed sequentially. If there are 10 accounts the request takes over a minute..
Like @chazmuzz , we're also noticing that remote relationships are executed sequentially. This makes the latency of some requests unusable since some of our custom resolvers take a couple hundred ms to respond, and we have ~10 of these relationships.
Is there any way to have these executed concurrently?
Like @chazmuzz , we're also noticing that remote relationships are executed sequentially. This makes the latency of some requests unusable since some of our custom resolvers take a couple hundred ms to respond, and we have ~10 of these relationships.
Is there any way to have these executed concurrently?
@kklin to workaround this issue I rewrote my query so that the remote schema field is in the query root.
The remote schema is able to execute resolvers in parallel, and call back into Hasura