R
R
raiboon2022-02-05 01:13:01
Software design
raiboon, 2022-02-05 01:13:01

What to choose grpc or graphql?

On the grpc side, performance in terms of the protocol and serialization format, on the other hand, on the graphql side, the ability to flexibly set the list of required entity fields, which improves performance, but a little on the other side.

Based on what parameters to choose one or another Framework / format?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2022-02-05
@vabka

Choose from how you intend to use it.
If you are developing both a client and a server, and at the same time the client can normally use grpc (not a browser) - take grpc.
If you are developing only the server, and the clients are different with different needs - then graphql.
Well, no one forbids combining - you can make a server with grpc, and provide a client api with graphql

D
Dmitry Belyaev, 2022-02-05
@bingo347

For an internal api (for example, when all clients are written in the same company as the api), various RPC protocols (for example, the same grpc) will be more efficient.

flexibly set the list of required entity fields
A well-designed RPC basically doesn't give away anything extra, while minimizing the need for multiple calls at a time. This allows you to make api with the lowest possible costs.
With GraphQL, you will have to work hard so that those data from different tables twitch through JOIN, and not through N queries with post-processing.
On the other hand, if the api is public, then generally accepted things like GraphQL or REST will be preferable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question