Skip to main content

Comparison

Performance benchmarks

gRPC is roughly 7 times faster than REST when receiving data & roughly 10 times faster than REST when sending data for this specific payload. This is mainly due to the tight packing of the Protocol Buffers and the use of HTTP/2 by gRPC. However I had to spend roughly 45 mins implementing this simple gRPC Service, where I only spent around 10 mins building the WebAPI.

https://medium.com/@EmperorRXF/evaluating-performance-of-rest-vs-grpc-1b8bdf0b22da

High-level comparison

FeaturegRPCHTTP APIs with JSON
ContractRequired (.proto)Optional (OpenAPI)
ProtocolHTTP/2HTTP
PayloadProtobuf (small, binary)JSON (large, human readable)
PrescriptivenessStrict specificationLoose. Any HTTP is valid.
StreamingClient, server, bi-directionalClient, server
Browser supportNo (requires grpc-web)Yes
SecurityTransport (TLS)Transport (TLS)
Client code-generationYesOpenAPI + third-party tooling
  • Microservices - gRPC is designed for low latency and high throughput communication. gRPC is great for lightweight microservices where efficiency is critical.
  • Point-to-point real-time communication - gRPC has excellent support for bi-directional streaming. gRPC services can push messages in real-time without polling.
  • Polyglot environments - gRPC tooling supports all popular development languages, making gRPC a good choice for multi-language environments.
  • Network constrained environments - gRPC messages are serialized with Protobuf, a lightweight message format. A gRPC message is always smaller than an equivalent JSON message.

gRPC weaknesses

  • Limited browser support
  • Not human readable

https://docs.microsoft.com/en-us/aspnet/core/grpc/comparison