gRPC
A fast binary RPC framework over HTTP/2 — how backend microservices call each other when JSON-over-REST is too slow or too loose.
In one line
gRPC is remote procedure calls with a contract: you define services and messages in a
.proto file, the toolchain generates typed client/server code, and calls travel as
compact binary (Protocol Buffers) over HTTP/2 with built-in streaming.
The problem it solves
JSON-over-REST is wonderful for public APIs but wasteful and loose between your own services: text parsing is slow at volume, and there's no compile-time guarantee the caller and callee agree on the shape. gRPC trades human-readability for speed and a strict contract — the right call for high-volume internal traffic.
How it works
- The
.protocontract is the single source of truth. Every language generates stubs from it, so a Python analytics service can call a Go ingestion service with compile-time type safety. - HTTP/2 gives multiplexing and four call shapes: unary (one request/response), server-streaming, client-streaming, and bidirectional streaming.
- Deadlines, retries, and load-balancing are first-class, not bolt-ons.
The trade-off: binary protocols are not browser-native (grpc-web exists as a bridge) and are harder to debug with curl than JSON.
gRPC vs REST/FHIR — where each belongs
| gRPC | REST / FHIR | |
|---|---|---|
| Audience | your own internal services | external partners, standards |
| Wire format | binary (Protobuf) | JSON |
| Strength | speed, streaming, type safety | universality, debuggability, standards |
The rule: the external, standards-facing edge stays FHIR/REST; gRPC is for inside the walls.
Where it shows up in digital health
Internal seams of health platforms: ingestion pipelines, ML inference services, device-gateway → cloud links — anywhere high-volume structured traffic flows between your own services.
Common pitfalls
- Exposing gRPC as your public API — partners expect FHIR/REST; keep gRPC internal.
- Skipping
.protoversioning — the contract evolves; manage backward compatibility deliberately. - Debuggability shock — invest in tooling (grpcurl, reflection) since curl won't do.
Key takeaways
- gRPC = contract-first RPC:
.proto→ generated typed stubs → binary over HTTP/2. - Four call shapes including bidirectional streaming; deadlines/retries built in.
- Fast and strict for internal service-to-service traffic; keep FHIR/REST at the edge.
- The efficient plumbing inside a health platform's walls.
अपना स्मरण जाँचें
2 में से 0 याददोबारा पढ़ने से बेहतर है सक्रिय स्मरण — पहले उत्तर सोचें, फिर देखें।
What is gRPC, and where does it belong?
What are gRPC's four call shapes?