You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running a microservice architecture based on the federation specs with apollo-gateway at the helm. One of the microservices defines a BasePost interface type, that is implemented by RegularPost and FeaturedPost, while another microservices defines a User type.
When I run a query to fetch blogs, their posts and authors, I get duplicated calls to the users microservices due to the BasePost interface. See the query planner below:
QueryPlan {
Sequence {
Fetch(service: "blogs") {
{
blogs {
id
posts {
__typename
... on RegularPost {
id
author {
id
__typename
}
}
... on FeaturedPost {
id
author {
id
__typename
}
}
}
}
}
},
Parallel {
Flatten(path: "blogs.@.posts.@.author") {
Fetch(service: "users") {
{
... on User {
__typename
id
}
} =>
{
... on User {
givenName
}
}
},
},
Flatten(path: "blogs.@.posts.@.author") {
Fetch(service: "users") {
{
... on User {
__typename
id
}
} =>
{
... on User {
givenName
}
}
},
},
},
},
}
Given the author has the same fields between the implementing types, I would expect a single Fetch to the users microservice. Is this behaviour normal?
Thanks!
The text was updated successfully, but these errors were encountered:
The gateway invokes 10s of duplicate backend service queries to the same service with the same set of identical query variables/representations. See log apollo-gw.log
This is a performance nightmare.
Is there any further work (PR's) that might help save me time trying to resolve this.
abernix
transferred this issue from apollographql/apollo-server
Jan 15, 2021
abernix
changed the title
[Federation] Gateway query planner duplicate calls to services on interface types
Query planner duplicate calls to services on interface types
Mar 4, 2021
Hello,
Packages: apollo-gateway v0.11.6
I'm running a microservice architecture based on the federation specs with apollo-gateway at the helm. One of the microservices defines a
BasePost
interface type, that is implemented byRegularPost
andFeaturedPost
, while another microservices defines aUser
type.When I run a query to fetch blogs, their posts and authors, I get duplicated calls to the users microservices due to the
BasePost
interface. See the query planner below:Given the author has the same fields between the implementing types, I would expect a single Fetch to the users microservice. Is this behaviour normal?
Thanks!
The text was updated successfully, but these errors were encountered: