QA
Beginner LevelREST APIs & Web Services

What is gRPC and how does Protocol Buffers (Protobuf) compare to REST/JSON?

❓ Interview Prompt: Compare REST/JSON (text-based, human-readable, HTTP/1.1 & HTTP/2) vs gRPC/Protobuf (binary serialized, HTTP/2 multiplexing, ultra-fast internal microservices).

gRPC is an open-source high-performance Remote Procedure Call (RPC) framework developed by Google:

Differences from REST:

•
Serialization: REST uses text-based JSON ('~100-500 bytes'). gRPC uses binary Protocol Buffers (Protobuf) ('~20-50 bytes'), achieving 5x-10x smaller payload size!
•
Transport Protocol: gRPC mandates HTTP/2 (multiplexing streams, header compression).
•
Schema Enforcement: Protobuf '.proto' files strictly generate strongly-typed code for client/server in multiple programming languages.

Code Implementation Example

yaml
// user.proto schema definition
syntax = "proto3";

message UserRequest {
  string user_id = 1;
}

message UserResponse {
  string id = 1;
  string name = 2;
  string email = 3;
}

service UserService {
  rpc GetUser (UserRequest) returns (UserResponse);
}
💡Protocol Buffer v3 service and message schema definition.
🎯 Interview Key Takeaway

Use REST/JSON for public web APIs; use gRPC/Protobuf for high-performance internal microservice communication.

#gRPC#Protobuf#REST vs gRPC#Beginner
Back to all REST APIs & Web Services Questions→

More REST APIs & Web Services Interview Questions

Beginner LevelREST APIs & Web Services

What is HTTP Method Idempotency and how do you implement Idempotency Keys for REST APIs?

Beginner LevelREST APIs & Web Services

What are standard HTTP Status Codes (200, 201, 204, 400, 401, 403, 404, 409, 429, 500, 503)?

Beginner LevelREST APIs & Web Services

What are HTTP Verbs (GET, POST, PUT, PATCH, DELETE) and when to use PUT vs PATCH?