Skip to main content
AllDevToolsHub
Back to Glossary

gRPC

A high-performance, open-source universal RPC framework developed by Google.

Detailed Explanation

gRPC uses HTTP/2 for transport and Protocol Buffers (protobuf) as the interface description language. It is much faster and more efficient than REST/JSON because it uses a binary format. It supports bidirectional streaming and is the preferred choice for communication between internal microservices where performance is critical.

Quick Summary

gRPC is a binary RPC framework built on HTTP/2 with Protocol Buffers as the schema language. It's the standard for high-performance, strongly-typed service-to-service calls, and a poor fit for public browser-facing APIs.

Key Takeaways

Key Takeaways

  • Schema-first: `.proto` files define service interfaces and message shapes; clients and servers are generated.
  • Four call patterns: unary, server-streaming, client-streaming, bidirectional streaming.
  • Binary protobuf wire format is 3-10× smaller than equivalent JSON.
  • Native browser support is limited; use gRPC-Web or a REST/GraphQL gateway at the edge.
  • Strong typing across languages is the main win, schemas catch breaking changes at build time, not runtime.
Use Cases

When to use it

  • Internal microservice-to-microservice communication where performance and contracts matter.
  • Polyglot environments, generated clients in Go, Python, Java, Rust, TS speak the same wire format.
  • Streaming workloads (large file transfers, live data feeds, real-time AI inference).
  • Backend-of-mobile-apps via gRPC clients on iOS/Android.
Watch out

Common Mistakes

  • Trying to expose gRPC directly to browsers, they can't speak HTTP/2 the way gRPC needs. Use gRPC-Web or a REST gateway.
  • Breaking schema changes (renumbering fields, removing required fields) that silently corrupt deserialization.
  • Skipping deadlines/timeouts; gRPC streams hold connections open indefinitely otherwise.
  • Hand-tuning protobuf for human readability; it's a wire format, not a config file.
FAQ

gRPC, Frequently Asked

gRPC or REST for internal services?

gRPC if you value speed, strong typing, and code generation across languages. REST if you value debuggability with curl, broad tool support, and simpler operations. Many large companies use gRPC internally and expose REST/GraphQL at the public edge.

How do I evolve a gRPC schema safely?

Never renumber fields. Never reuse a deprecated field number. Add new fields with new numbers; mark old ones `reserved` or `deprecated`. protobuf is designed for forward and backward compatibility if you follow these rules.

Related Terms