Google Stubby diventa open
gRPC è la versione open source di Stubby, il sistema RPC interno di Google usato per oltre un decennio per miliardi di richieste al secondo tra servizi. Google decide di aprirlo per uniformare lo spazio micro-servizi industriale.
Il rilascio
gRPC 1.0 è rilasciato il 23 agosto 2016. Licenza Apache 2.0. Donato alla CNCF (Cloud Native Computing Foundation). Nome: “gRPC Remote Procedure Calls” (acronimo ricorsivo). Ispirazione storica: RPC UNIX, CORBA, SOAP, Thrift (Facebook), Avro (Hadoop).
Architettura
- HTTP/2 come transport — multiplexing, streaming, header compression
- Protocol Buffers (protobuf) come IDL e wire format — schema binario compatto e typed
- Code generation per client e server in 10+ linguaggi
service UserService {
rpc GetUser (UserRequest) returns (User);
rpc ListUsers (UsersRequest) returns (stream User);
}
message UserRequest { string id = 1; }
message User { string id = 1; string name = 2; }
Tipi di chiamata
- Unary — una request, una response
- Server streaming — una request, molte response
- Client streaming — molte request, una response
- Bidirectional streaming — entrambi streamano
Vantaggi
- Performance — binary protobuf vs JSON: 3-10× più compatto e veloce
- Type safety — schema contract enforced
- Polyglot — C++, Java, Go, Python, Ruby, Node, PHP, C#, Dart, Kotlin, Swift
- Streaming nativo — RPC e dati in un’unica connessione
- Deadlines e cancellation — built-in
- Interceptor — middleware-like
Limiti
- Debug difficile — no human-readable payload, serve
grpcurloBloomRPC - Browser — HTTP/2 trailer non supportati in fetch; servono gRPC-Web o Connect
- Load balancing L7 più complesso di HTTP/1.1 JSON
- Schema migration — rompere backward compatibility in protobuf è facile
Strumenti
- gRPC-Web — bridge browser→server via proxy Envoy
- Connect (Buf, 2022) — gRPC + gRPC-Web + REST-JSON unified
- Buf — protobuf linter/breaking detection/registry
- Protolock — contract versioning
Adozione
gRPC è usato in ambienti tech di alto profilo:
- Google Cloud API interne
- Netflix — Ribbon, Eureka migration
- Uber — RIB framework
- Square, Slack, Dropbox — micro-servizi interni
- Cockroach DB, etcd, Dgraph — protocolli interni
Nel contesto italiano
gRPC è presente in team tech-forward italiani:
- Fintech — micro-servizi interni (Fineco, Banca Sella, challenger)
- Trading platforms — latenza bassa
- AI/ML serving — Triton Inference Server, Ray Serve usano gRPC
- Industrial IoT — edge computing con streaming
- Startup cloud-native — Go e Rust ecosystem
Riferimenti: gRPC 1.0 (23 agosto 2016). Google. Licenza Apache 2.0. CNCF project. Basato su HTTP/2 e Protocol Buffers. Tipi unary/streaming. Estensioni gRPC-Web, Connect (Buf).
