Performance difference between REST and gRPC

Many claims that it is possible to use gRPC using gRPC-gateway to convert JSON to protobuf, in order to make the communication faster. But I wonder how many are using gRPC in conjuction with Web to communicate with a SQL database? What is your motivation and what are the benefits?

I suppose it’s like any technology. Most technologies are pretty good and do what they do very well, it all comes down to use case.

You’d have to weigh up the for and against for your use case. If for example, your application only needs endpoints to be able to read and write to an SQL database, it might be that a simple JSON REST API is perfectly fine, without the added complexity of an RPC layer.

To go back to what I mentioned previously, If your application expands and you were to introduce multiple services then gRPC & Protocol Buffers would be a great candidate for internal service communication, but again it would come down to use case.

Protocol Buffers have some really compelling advantages over JSON particularly regarding types and serialisation speed, but having an RPC Gateway that I expect would (don’t quote me on this) deserialise the JSON in any event to then serialise to a Protocol Buffer, might be added overhead to your application where it isn’t necessary.

There are a ton of companies using gRPC at significant scale, to name a couple Google and Netflix. If you have a look around there are some interesting articles breaking down how companies use gRPC in their services.

https://www.cncf.io/netflix-case-study/