Re:REST vs. GraphQL – A search for evidence on which is better
by mumblemumble on Tuesday December 15, 2020 @10:42PM
(#25438794)
Sure, but that's a great example of what I'm getting at. All that complexity may let you do some pretty cool things. But it also comes at a cost, in terms of both development effort and implementation complexity, and I certainly wouldn't call it easy.
I fear, sometimes, that our collective tendency to prefer talking about the most interesting or most capable technologies tends to bias us toward over-engineering. Slinging JSON over HTTP is, in my personal opinion, a pretty hokey hack. But it's also the option that's the easiest to implement, the most widely understood, and, more often than not, it's more than up to the task.
Re:REST vs. GraphQL – A search for evidence on which is better
by haimez on Tuesday December 15, 2020 @10:35PM
(#25438748)
> Instead, you need to make separate parallel requests for those datapoints and let the dataloader be in charge of merging them into larger batches of requests for the db to fullfill.
> This can result in some additional latency on a request, but ultimately provides the best way to be able to scale things out.
I promise you, this is not the best way to scale things out.
Re:REST vs. GraphQL – A search for evidence on which is better
by Aeolun on Wednesday December 16, 2020 @07:14AM
(#25441666)
You cannot make a statement like that and then not provide an alternative. Personally I think dataloader makes amazing use of Javascript async.
There may be other ways to scale things out, but that doesn’t mean this one isn’t good.
How do you do that? https://github.com/graphql/dataloader
However, to be super efficient you need to give up on some consistency. You simply can't have data points which join directly in the db. Instead, you need to make separate parallel requests for those datapoints and let the dataloader be in charge of merging them into larger batches of requests for the db to fullfill.
This can result in some additional latency on a request, but ultimately provides the best way to be able to scale things out.
The benefit of rest is that it's easier to make a really fast on single request endpoint. You can precisely tune your db indexes to match your queries. For graphql to be fast and not kill your DB with a malicious query, you need to introduce that wait time/batching.