liveBook · Manning

gRPC

As explained in gRPC Microservices in Go

An open-source framework for implementing remote procedure calls with generated service bindings and protocol-buffer serialization, commonly transported over HTTP/2.

gRPC is an open-source remote procedure call framework for connecting services. Define service methods and messages with protocol buffers, then generate server bindings and client stubs. A client calls a remote method through its stub, while the server implements the business logic. Generated bindings let services written in different languages share a contract without sharing language-specific models. section 1.0 section 1.1.2

Protocol buffers serialize messages into compact binary data, which gRPC exchanges over HTTP/2. The combination suits low-latency interservice calls and supports unary and streaming communication. It does not make a network call as simple as an in-process method call: services still need to handle failures and secure their connections. gRPC provides facilities for load balancing, tracing, health checking, and authentication. section 1.1.1 section 1.2 section 2.5 section 1.1

Choose the interface to fit its consumers:

  • Use gRPC when low latency, streaming, or clients in multiple languages justify maintaining service definitions and generated bindings. section 1.2 section 1.3
  • Consider REST for browser-facing APIs or a small application with only one or two services. Browser access to a gRPC service may require a proxy layer; internal services can still use gRPC. section 1.2 section 1.3
  • Treat changes to protocol-buffer definitions as contract changes. Generated clients help reveal mismatches, but maintaining the definitions and their compatibility remains part of the work. section 1.3 section 3.0

Checkout calling other services

In an e-commerce system, a Checkout service can add generated Go stubs as dependencies to fetch cart items from Cart, obtain an address from Shipping, and request a charge from Payment. Each call crosses a service boundary, so the client must account for network failure rather than treating the stub as a local function. section 1.4.1

For a production implementation, keep the .proto definitions maintainable, generate bindings through CI/CD, and account for testing, security, and deployment alongside the service code. gRPC supplies the communication framework; it does not remove the operational work created by decomposing an application into services. section 3.0 section 1.4 section 1.1

How gRPC Microservices in Go covers it

How deep it goes
Defines the framework and sketches its transport, serialization, trade-offs, and stub workflow; defers detailed generation and compatibility work.
Examples
Uses an e-commerce Checkout service calling Cart, Shipping, and Payment through generated Go stubs.
What it assumes
Introduces Go, microservices, and gRPC for newcomers rather than requiring prior familiarity with all three.
What you can do after
Build it from scratch as Go microservice communication using protocol-buffer definitions and generated stubs within a production-oriented workflow.
How it connects
Links remote procedure calls to protocol buffers, HTTP/2, microservices, REST, and service contracts.

Also explained in

Compare how 10 books explain gRPC →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of gRPC Microservices in Go. The section links point to the parts of the book it draws on.