Comments (2)
Hi @zekenie β sorry for the delay in reply, I missed your issue coming in. You can find the primary batching code here: https://github.com/gmac/graphql-stitching-ruby/blob/main/lib/graphql/stitching/executor.rb#L87-L130. It uses a query batching strategy to combine all requests bound for the same location into a single request.
TL;DR β what this means is that stitching will make one request per location per generation of data... "per generation" is a key note, because there's no real optimization for getting data from A, joining that to B, then joining B's data back to A... it's a hard constraint that you're going to have to visit A twice.
Have a look at this chapter in my stitching book for best practices and to understand merging better: https://github.com/gmac/schema-stitching-handbook/tree/main/type-merging-arrays. Distilled action item would be: stitch using list queries whenever possible, and stitching will surprise you about how efficient it can be.
from graphql-stitching-ruby.
Oh, one other tip I forgot to mention that's general GraphQL but highly relevant to stitching: make sure that your root fields are batched. This anticipates multiple calls to the same root fields in a request will resolve without N+1.
from graphql-stitching-ruby.
Related Issues (20)
- Feat: hoist inlined inputs
- Support for multipart form file uploads? HOT 8
- Support field-level authorization
- Remote errors are not properly propagated to clients HOT 3
- Need conditional type checks during execution HOT 1
- Plan runtime directives, @skip and @include
- Batch all queries to a location per execution frame HOT 1
- Consider renaming `@boundary` to `@stitch` HOT 1
- All hashes should use string keys
- Support GraphQL v1.13 HOT 1
- Root field location selector doesnβt provide operation type
- Need Shaper component
- Need async executor execution HOT 1
- Issue mapping Enum values to keys in Composer.build_enum_type HOT 3
- Argument defaults are ignored during composition HOT 1
- Arguments are dropped during composition HOT 1
- Need a Gateway component
- Variables with boolean value `false` are overwritten in Request.prepare! HOT 2
- Remote errors are not properly propagated to clients HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-stitching-ruby.