Grpc Advantages Over Rest Apis

Viewed 1128

What are the advantages of grpc protocol over rest apis? When I googled, I came across this two points:

  1. json vs. stubs

  2. grpc is based on http/2 where as rest is based on http/1.

I couldn't understand exactly how this is beneficial?

Can someone also helps me out with how grpc works and what are the advantages of using it over rest api and explain the above two points?

Thanks.

1 Answers

First about the payload data :
REST uses JSON, it is text and large
gRPC uses Protocol buffer to serialize payload data, it is binary and small

Second about the protocol :
REST uses HTTP/1 by default (but today we can use HTTP/2 in REST)
gRPC uses HTTP/2, it is much faster than HTTP/1.1

Related