Debugging GraphQL N+1 Issues with Open Source Tracing Tools
1–10 of 14 posts
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#2In addition, we've deployed all the required infrastructure like an OTEL Collector and OTEL backend using Clickhouse to offer a managed end-to-end solution including dashboard for traces and a trace overview. A live demo can be found here (sign up for free into the demo org): https://cloud.wundergraph.com/wundergraph-demo/apollo-federa...
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#3But from this it sounds like that's something you have to detect and code for directly... which we'd have happily done in the existing code anyway?
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#4When my tech lead decided we were going to move to GraphQL, one of the reasons I was told it was great was because it solves/avoids the n+1 problem. But from this it sounds like that's something you have to detect and code for directly... which we'd have happily done in the existing code anyway?
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#5When my tech lead decided we were going to move to GraphQL, one of the reasons I was told it was great was because it solves/avoids the n+1 problem. But from this it sounds like that's something you have to detect and code for directly... which we'd have happily done in the existing code anyway?
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#6When my tech lead decided we were going to move to GraphQL, one of the reasons I was told it was great was because it solves/avoids the n+1 problem. But from this it sounds like that's something you have to detect and code for directly... which we'd have happily done in the existing code anyway?
> one of the reasons I was told it was great was because it solves/avoids the n+1 problem
So, the thing about GraphQL is that it's a _specification_, in the same way that REST or gRPC are specifications.There's nothing inherent in either GraphQL or REST that admits or prevents the N+1 problem. You have endpoints with business logic (or in GQL's case, "resolvers") and there's no telling what's inside of those methods code.
It's true that GraphQL was built to integrate with tools like a "Dataloader" to solve "N+1", but you could just as validly be using a Dataloader in your REST or gRPC API endpoints.
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#7When my tech lead decided we were going to move to GraphQL, one of the reasons I was told it was great was because it solves/avoids the n+1 problem. But from this it sounds like that's something you have to detect and code for directly... which we'd have happily done in the existing code anyway?
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#8When my tech lead decided we were going to move to GraphQL, one of the reasons I was told it was great was because it solves/avoids the n+1 problem. But from this it sounds like that's something you have to detect and code for directly... which we'd have happily done in the existing code anyway?
I have used Dataloaders in the past in both Go and Typescript and it just about solves the issue automatically. Dataloader is a specific library that is copied for different languages that allows you to write code that looks like N+1, but it will group the N part into batches, so it becomes just 1+1. It’s kind of weird to explain, but it should be easy to understand once you start working with them.
They are a solution, but not necessarily a good one. And GraphQL doesn't lend itself to goos solutions.
Re: Debugging GraphQL N+1 Issues with Open Source Tracing Tools
#9When my tech lead decided we were going to move to GraphQL, one of the reasons I was told it was great was because it solves/avoids the n+1 problem. But from this it sounds like that's something you have to detect and code for directly... which we'd have happily done in the existing code anyway?