A blog about software engineering, software architecture, distributed systems, cloud computing, and technology leadership.
Hi, I'm Vinicius Serpa (or simply Mestre). I'm a staff-level software engineer, currently working as a Systems Architect at Nextpower Inc.
by Vinicius Serpa
In the world of distributed systems and microservices, efficient communication between services is critical. That’s where gRPC comes in—a high-performance, open-source Remote Procedure Call (RPC) framework originally developed by Google and now maintained by the Cloud Native Computing Foundation (CNCF).
gRPC is designed to make inter-service communication fast, lightweight, secure, and language-agnostic, making it a powerful tool for modern software architectures.
This boilerplate covers gRPC implementation and the use of Evans client
gRPC shines in scenarios where performance and scalability are key:
.proto files.Official support includes:
At the heart of gRPC is Protocol Buffers, a language-neutral, platform-neutral, extensible mechanism for serializing structured data.
Unlike JSON, Protobuf is binary, which means:
| JSON (Human-readable) | Protocol Buffers (Binary) |
|---|---|
| Larger payload | Smaller payload |
| Higher CPU usage | Lower CPU usage |
| More network overhead | Less network overhead |
| Slower processing | Faster processing |
.proto SchemaThis schema defines the contract between client and server, ensuring both sides understand the structure of the data being exchanged.
syntax = "proto3";
message SearchRequest {
string query = 1;
int32 page_number = 2;
int32 request_per_page = 3;
}
gRPC uses HTTP/2, which brings several advantages:
| Feature | REST | gRPC |
|---|---|---|
| Data Format | JSON / Text | Protocol Buffers (Binary) |
| Communication | Unidirectional | Bidirectional & Async |
| Latency | Higher | Lower |
| Contract | Optional | Required (.proto files) |
| Streaming Support | No | Yes |
| Design Constraints | Predefined (HTTP verbs) | Flexible |
| Tooling | Third-party libs | Native + Code Generation |