liveBook · Manning

gRPC

As explained in Building Web APIs with ASP.NET Core

gRPC is a high-performance, cross-platform remote procedure call framework for communication between distributed applications.

gRPC is a language-agnostic, cross-platform, open-source remote procedure call architecture designed for high-speed communication among microservices. It transports messages with HTTP/2 and uses protocol buffers instead of JSON. section 10.3

Compared with REST and GraphQL, gRPC emphasizes efficient service-to-service communication through HTTP/2, binary serialization, multiplexing, and bidirectional streaming. section 10.0 section 10.3.1

gRPC is attractive when communication efficiency matters:

  • Runs on almost any hardware that supports HTTP/2. section 10.3.1
  • Reduces latency through HTTP/2 handshake optimizations. section 10.3.1
  • Reduces network use through compact protobuf serialization. section 10.3.1
  • Supports bidirectional streaming and multiplexed communication rather than only request-response exchanges. section 10.3.1

Account for important trade-offs before choosing it:

  • Implementation is more complex and slower than an equivalent REST API. section 10.3.2
  • Browsers and many client frameworks lack direct gRPC support; gRPC-Web improves compatibility but remains limited. section 10.3.2
  • Binary payloads require dedicated tools for inspection, debugging, logging, and manual requests. section 10.3.2
  • Responses are difficult to cache through intermediaries, and predefined typed responses can cause overfetching or underfetching. section 10.3.2

Extending a board-game gRPC API

Define protobuf methods for GetDomain, UpdateDomain, GetMechanic, and UpdateMechanic, specifying input and output types alongside existing request and response messages. Restrict the two update methods to users with the Moderator role by applying authorization. section 10.5.3

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Defines transport and serialization choices, explains performance and limitations, and sketches protobuf and authorization changes without showing implementation code.
Examples
Uses board-game domain and mechanic operations, protobuf request and response messages, and Moderator-only update methods.
What you can do after
Implement gRPC service features in an ASP.NET Core application using Grpc.AspNetCore, protobuf message types, and role-based authorization.
How it connects
Connects gRPC with REST, GraphQL, HTTP/2, protocol buffers, microservices, gRPC-Web, caching, and authorization.

Also explained in

Compare how 10 books explain gRPC →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.