Api Design medium
You're choosing between REST and gRPC for internal service-to-service calls. When is gRPC preferred?
- A When you need native browser support across all legacy environments without utilizing polyfills or specialized proxy libraries.
- B When you require high performance through binary protocols, strict contract enforcement via Protobuf, and bidirectional streaming support.
- C When human readability of request and response payloads is a primary requirement for debugging with standard browser dev tools.
- D When you want to avoid the overhead of defining a strict schema and prefer the flexibility of schema-less JSON message formats.
Answer: B. When you require high performance through binary protocols, strict contract enforcement via Protobuf, and bidirectional streaming support.
**gRPC** (based on HTTP/2 and Protobuf) is often preferred for internal service-to-service communication due to its high performance (binary serialization, multiplexing) and strong contract enforcement (typed schemas). While REST is excellent for public-facing APIs due to its ubiquity and debuggability, gRPC offers efficiency gains critical for high-throughput internal traffic.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- You're designing a REST API for a blog. Which endpoint best represents 'get all comments for post 123'?
- A client wants to update only the 'status' field of an order, leaving other fields unchanged. Which HTTP method is most appropriate?
- A client calls POST /users with valid data, and the user is created. What status code should the server return?
- A client retries a failed 'POST /payments' request due to network timeout. The server receives the request twice. Without idempotency handling, what can happen?
- An API returns 10,000 products. Returning all in one response is impractical. Which pagination approach is simple and stateless?
- Your API serves both mobile apps and third-party integrations. Which authentication method is most appropriate?