Giter VIP home page Giter VIP logo

Comments (2)

gmac avatar gmac commented on June 3, 2024 1

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.

gmac avatar gmac commented on June 3, 2024 1

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.