-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Enable batched queries #442
Comments
https://www.apollographql.com/docs/graphos/routing/performance/query-batching This has all the documentation including sample queries. It looks like it's just a couple lines to configure this feature. |
I'm currently working on this. I'm new to the project, so it will likely take me a bit longer, and if anyone wants to join, ping me on discord (Infinity00) @Vichy97, since I'm new to openbeta, can you provide more specific requirements for this? If you could give me an example of the one large query you're currently making, and what kind of batched query you want to make? Happy to chat in Discord too. |
I would like the ability to query all the climbs and areas in an entire state. I plan to have that query automatically broken down and sent as batched queries using the Kotlin Apollo client. I believe this is basically automatically handled for you on the server side as long as you follow the configuration in that documentation I linked. |
@Vichy97 according to the page you sent the batching feature is only available to Enterprise plan. In general the slowness you're seeing is a classic n+1 problem. Consider this query, getting info & all images for Red Rock and the next immediate children and their images. query MyQuery {
area(uuid: "bea6bf11-de53-5046-a5b4-b89217b7e9bc") {
areaName
media {
id
}
children {
areaName
media {
id
}
}
}
} For each child of Red Rock (let's say there's 20 of them), the backend sends a separate query to the media collection, or 20 queries. We're subclassing the mongo data source class that is supposed to be smart enough to run only 1 query, We'll need to rewrite how we resolve the media field or add a new batch download query for mobile to download multiple areas + photos at once. |
Batched queries will be vital for supporting offline mode for the mobile app. It's not realistic to do one large query as this can take upwards of a full minute for an entire state and often times out or fails. Apollo makes it super easy to split this into batches, but only if it's supported on the backend.
The text was updated successfully, but these errors were encountered: