BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Releases gRPC, a HTTP/2 RPC Framework for Microservices

Google Releases gRPC, a HTTP/2 RPC Framework for Microservices

Lire ce contenu en français

Google has opened sourced gRPC, a RPC framework used internally to connect cloud microservices. gRPC comes with support for 10 languages, making it attractive for creating back-end cloud services for mobile applications.

gRPC is a language and platform-neutral RPC system developed and used internally by Google in many areas including cloud computing services, and they are going to expose most of their public APIs through such endpoints. Google considers gRPC a “bandwidth and CPU efficient, low latency way to create massively distributed systems that span data centers, as well as power mobile apps, real-time communications, IoT devices and APIs.”

While it can be used in many scenarios, gRPC is targeted primarily at microservices. A service interface and the data types it handles is defined using the Protocol Buffers IDL, and with the help of compilers one can generate client and server stubs in 10 languages: C, C++, C#, Go, Java, Node.js, Objective-C, PHP, Python, Ruby. The Java implementation seems to be mature, while the others are in Alpha (ready for early adopters) or pre-Alpha. Except for the Go and Java implementations, the others are wrappers around a C implementation of the core library. There is not yet an implementation for the browser, but Google is “actively exploring” such an option and invites for feedback.

The default data serialization format is Protocol Buffers, a new version Proto3 being just released. Besides a simplified syntax, Proto3 supports more languages and JSON encoding. gRPC can be extended to support other data formats as desired.

Answering to a question on why one would use gRPC over REST for microservices, Google writes:

gRPC largely follows HTTP semantics over HTTP/2 but we explicitly allow for full-duplex streaming. We diverge from typical REST conventions as we use static paths for performance reasons during call dispatch as parsing call parameters from paths, query parameters and payload body adds latency and complexity. We have also formalized a set of errors that we believe are more directly applicable to API uses cases than the HTTP status codes.

Providing support for generating client libraries for iOS and Android and running on HTTP/2, Google hopes developers will use gRPC to build back-end services for mobile applications. They consider that “bidirectional streaming, flow control, header compression, and multiplexing requests over a single TCP connection“ will “save battery life and data usage on mobile devices while speeding up services and web applications running in the cloud.”

The gRPC source code has been made available on GitHub under a BSD license.

Rate this Article

Adoption
Style

BT