hyuuu 5 days ago

N+1 is a solved problem at the framework level If GraphQL actually affects your performance, congratulations, your application is EXTREMELY popular, more so than Facebook, and they use graphql. There are also persisted queries etc.

Not sure about caching, if anything, graphql offers a more granular level of caching so it can be reused even more?

The only issue I see with graphql is the tooling makes it much harder to get it started on a new project, but the recent projects such as gql.tada makes it much easier, though still could be easier.

2
rwieruch 5 days ago

I have been out of touch with the GraphQL ecosystem for a while. What are the status quo solutions to the problems stated above?

N+1 I just remember the dataloader https://github.com/graphql/dataloader Is it still used?

What about the other things? I remember that Stitching and E2E type safety, for example, were pretty brittle in 2018.

YuukiRey 5 days ago

We use the dataloader pattern (albeit an in-house Golang implementation) and it has solved all our N+1 problems.

E2E type safety in our case is handled by Typescript code generation. It works very well. I also happen to have to work in a NextJS codebase, which is the worst piece of technology I have ever had the displeasure of working with, and I don't really see any meaningful difference on a day to day basis between the type sharing in the NextJS codebase (where server/client is a very fuzzy boundary) and the other code base that just uses code generation and is a client only SPA.

For stitching we use Nautilus and I've never observed any issues with it. We had one outage because of some description that was updated in some dependency and that sucked but for the most part it just works. Our usage is probably relatively simple though.

rwieruch 5 days ago

Thanks, really appreciate your reply!

hyuuu 4 days ago

if you use node then you have the following for N+1, by having a tighter integration with the database, for ex: https://www.graphile.org/postgraphile/performance/#how-is-it...

or prisma

https://pothos-graphql.dev/docs/plugins/prisma/relations

moi2388 5 days ago

Isn’t every graphql a post, so no http response caching, so you need to do it in-app or with redis?

N+1 and nested queries etc were still problems last I checked (few years ago).

I’m sure there are solutions. Just that it’s not as trivial as “use graphql” and your problems are solved.

Please correct me if I’m wrong

hyuuu 4 days ago

it used to be the case that graphql requests are in POST, but not anymore: https://nearform.com/open-source/urql/docs/api/core/#:~:text... example for urql

on top of http level caching, you can do any type of caching (redis / fs / etc) just like a regular rest but at a granular level, for ex: user {comments(threadId: abc, page: 1, limit: 20) { body, postedAt} is requested and then cached, another request can come in thread(id: abc) {comments(page: 1, limit: 20) {body, postedAt} you can share the cache.

N+1 is solved by a tighter integration with the database, for ex: https://www.graphile.org/postgraphile/performance/#how-is-it... or maybe a more popular flavor using prisma: https://pothos-graphql.dev/docs/plugins/prisma/relations#:~:...

but of course, there is always the classic dataloader as well.

I am not saying that use graphql and all the problems will be solved, but i am saying that the problem that OP proposed has been solved in an arguably "better" way, as it does not tie the presentation (HTML) with the data for cases of multiplatform apps like web, or native apps.