Glossary · 2 · Developer SDKs and APIs
gRPC
In software engineering, gRPC is an open-source remote procedure call framework in which services are defined in an interface definition language, by default Protocol Buffers, from which client stubs and server code are generated, and calls, unary or streaming, are carried over HTTP/2.
- Developer SDK
- APIs
In one sentence
gRPC is an open-source RPC framework: services defined in Protocol Buffers, generated client stubs and server code, unary and streaming calls over HTTP/2.
Example
A machine-data service defines a GetStatus call and a streaming WatchAlarms call in a .proto file; the team generates Go server code and Python and Java client stubs from it.
How it applies
- Developer SDKs: gRPC is a common alternative to a REST API for service-to-service communication. A client application calls a method on a server on another machine as if it were a local object; on the client side a stub, generated from the service definition, provides the same methods as the server. It is a form of remote procedure call (RPC).
- Contract first: The service definition (by default a Protocol Buffers .proto file, used both as interface definition language and as message format) is the interface contract. Clients and servers in different languages are generated from it (automatic code generation), so SDKs in several languages stay consistent.
- Call types: gRPC defines unary calls (one request, one response), server streaming, client streaming and bidirectional streaming, plus deadlines, cancellation and metadata. Streaming suits telemetry, logs and event feeds.
- Transport: The gRPC protocol is specified on top of HTTP/2 framing. Browsers reach gRPC services through gRPC-Web, which the gRPC tutorial pairs with a proxy (Envoy) in front of the service; this is one reason public APIs often offer REST as well.
- Platform and hardware SDKs: Edge and device-management kits use gRPC between local agents and services; host applications use it for out-of-process extensions.
- Documentation: Publish the .proto files as the reference, with comments, the package and version scheme, error codes, deadlines and retry guidance; generated reference pages should be built from the same files as the code.
gRPC vs. REST
REST exposes resources through HTTP methods and usually JSON, readable without generated code and easy to call from browsers. gRPC exposes methods defined in a contract, with compact binary messages, generated stubs and native streaming. Many systems use gRPC internally and REST at the public edge.
External references
- gRPC Authors: Introduction to gRPC
- gRPC Authors: Core concepts, architecture and lifecycle
- gRPC project: gRPC over HTTP2
- gRPC Authors: gRPC-Web basics tutorial