Last Updated: November 21, 2025
gRPC
High-performance RPC framework
Core Features
| Item | Description |
|---|---|
Protocol Buffers
|
Efficient serialization |
HTTP/2
|
Multiplexed connections |
Streaming
|
Bidirectional streaming |
Language Agnostic
|
Many language bindings |
Type Safety
|
Strong typing |
Code Generation
|
Auto-generate clients/servers |
Service Definition
// proto file
syntax = "proto3";
service UserService {
rpc GetUser (UserRequest) returns (UserResponse);
}
message UserRequest {
string user_id = 1;
}
message UserResponse {
string name = 1;
string email = 2;
}
// Server implementation (Node.js)
function getUser(call, callback) {
callback(null, {
name: 'John Doe',
email: 'john@example.com'
});
}
Communication Patterns
| Item | Description |
|---|---|
Unary RPC
|
Single request/response |
Server Streaming
|
One request, stream responses |
Client Streaming
|
Stream requests, one response |
Bidirectional
|
Both stream simultaneously |
Best Practices
- Use Protocol Buffers for schemas
- Implement proper error handling
- Use streaming for large data transfers
- Add deadline/timeout to calls
💡 Pro Tips
Quick Reference
gRPC is ideal for microservice communication