3 ms·
If your problem is that getting the data from the API is slow, both GraphQL and HTTP2 solve your problem: HTTP2 allows you to send REST requests faster, both mo
by wongarsu 7y ago
If your problem is that getting the data from the API is slow, both GraphQL and HTTP2 solve your problem: HTTP2 allows you to send REST requests faster, both more concurrently and with faster round trip; GraphQL instead allows you to combine all your requests into a single request that takes a single round trip.
GraphQL obviously provides a more complete solution (one request is better than many), but at the cost of a lot of complexity.
- eyelidlessness 7y ago> one request is better than many This is plainly not true. Web servers are designed to serve concurrent requests. So are databases. HTTP2 drastically improves the networking part of this. GraphQL offers a unified request-response object without needing to combine responses. It provides no guarantees about improved performance, particularly when the solution is automated and there's no way for a requester to reason about the performance implication of the queries they're issuing. It almost certainly provides worse performance than well designed RESTful endpoints requested concurrently.
- robjan 7y agoGraphQL also moves the N+1 problem (data fetching being dependent on other data that you are fetching) to the server side where latencies should theoretically be lower.