.NET Architecture & System Design Interview Question #117
What is the difference between REST and gRPC?
Microservices, API Gateway, Service Communication & Event-Driven Architecture Mid-Level Intermediate
Quick Interview Answer
REST commonly uses HTTP with JSON and resource-oriented conventions, making it broadly interoperable and easy for web clients to consume. gRPC typically uses HTTP/2 with Protocol Buffers and strongly typed service contracts.
Detailed Explanation
REST commonly uses HTTP with JSON and resource-oriented conventions, making it broadly interoperable and easy for web clients to consume. gRPC typically uses HTTP/2 with Protocol Buffers and strongly typed service contracts.
gRPC is often attractive for internal low-latency communication and streaming, while REST is common for public and browser-facing APIs. Neither is universally better; client compatibility and operational requirements matter.
Code Example
REST:
HTTP + JSON
human-readable
broad client support
gRPC:
HTTP/2 + Protobuf
typed contracts
efficient binary messages