Giter Club home page Giter Club logo

Comments (6)

marktani avatar marktani commented on May 18, 2024 2

Hey @harrisrobin, after the new batching support in prisma-binding, we've seen tremendous improvements in performance. I'm sure @timsuchanek can provide more details on this one than me 🙂

Please give it a try, thanks for bringing this up in the first place! I'm closing this discussion for now, feel free to open another ticket if you encounter any other question.

from graphql-prisma-typescript.

timsuchanek avatar timsuchanek commented on May 18, 2024 1

Yes, in my example application that included exactly the use case you described, I could reduce the query time from 19s to 1.6s, while having multiple roundtrips from eu to us. Would be interesting to hear, if you also see performance gains :)

from graphql-prisma-typescript.

marktani avatar marktani commented on May 18, 2024

Your first query takes ~2 seconds for me. That should take much shorter.

The demo endpoint is helpful for comfirming that queries take long, but it's difficult to say what happens "behind the scenes". I just did a bunch of tests with aggregation queries with my own service, and all of them had much better performance.

Did you try to connect directly to your Prisma endpoint and run the raw query that is done by the Prisma binding?

My current assessment is that the latency between your deployed GraphQL Yoga server to the Prisma endpoint is the main factor for the long duration. On what now tier is your instance deployed? Where is it deployed to?

Please share more information so we can look into that further 🙂

from graphql-prisma-typescript.

schickling avatar schickling commented on May 18, 2024

Currently prisma-binding doesn't make use yet of the dataloader pattern – which is a critical pending improvement (prisma-labs/prisma-binding#7). This will most likely also negatively impact the current situation.

@harrisrobin can you confirm this just happens when using the hosted development cluster of Prisma and not when you're running Prisma locally? I suspect this to be a result of request throttling which will no longer be an issue once dataloader support in prisma-binding was introduced.

from graphql-prisma-typescript.

harrisrobin avatar harrisrobin commented on May 18, 2024

@schickling you are correct. I can confirm that this does not happen in local.

No custom resolver on local

query {
  spaces {
    id
    name
  }
}

screenshot 2018-01-25 14 27 55

with custom resolver on local

query {
  spaces {
    id
    name
    avgRating
  }
}
}

screenshot 2018-01-25 14 29 24

from graphql-prisma-typescript.

sorenbs avatar sorenbs commented on May 18, 2024

One extra piece of information: I just tried to send an invalid query to your API. It should involve no db communication and thus should be really fast. A query from Berlin averages 800 ms for me, which is 2-3x what I would expect. Can you try to look at your now dashboard to verify that it is not getting frozen and unfrozen all the time?

This doesn't explain the increased latency when adding more resolvers though. What I suspect is happening is that your requests to Prisma are being throttled. The free dev clusters queue up requests to ensure that no service performs more than 1 request per second. I think we need to allow for short bursts to allow use cases like this. I will follow up here when we have implemented this change.

from graphql-prisma-typescript.

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.