Free tech learning for everyone, from basics to pro

Distributed SystemsSystems ArchitectureIntermediate

Microservice communication: REST, gRPC and service mesh

In short: Microservices communicate synchronously with REST or gRPC, or asynchronously with events. Each remote call can fail, so use timeouts, retries and circuit breakers. An API gateway manages traffic from outside; a service mesh handles encryption, retries and telemetry between services.

Synchronous options

Service communication stylesRESTHTTP + JSONgRPCHTTP/2 + ProtobufGraphQLclient picks fieldsMessagingasync eventsService meshsidecar proxiesAPI gatewayedge entry point
Figure 1. Common ways microservices talk to each other and to clients.
AspectRESTgRPC
TransportHTTP/1.1 or HTTP/2HTTP/2
PayloadUsually JSON (text)Protocol Buffers (binary)
ContractOptional, often OpenAPIRequired .proto file
StreamingLimitedClient, server and bidirectional
Browser supportNativeNeeds a proxy such as gRPC-Web
Best forPublic APIs, simple integrationFast internal service-to-service calls

REST uses resources and standard HTTP methods, and is easy to test with curl. gRPC generates client and server code from a schema, so calls look like local functions and payloads are compact. Many organisations use REST at the edge and gRPC inside.

A gRPC contract looks like this:

syntax = "proto3";
service Orders {
  rpc GetOrder (OrderRequest) returns (OrderReply);
}
message OrderRequest { string order_id = 1; }
message OrderReply { string order_id = 1; string status = 2; }

Asynchronous events

Instead of calling the stock service, an order service can publish an OrderPlaced event and let interested services react (see message queues and event streaming). This removes runtime coupling, but makes flows harder to trace. Long business processes across services are often handled as a saga: a series of local steps with compensating actions if a later step fails.

Resilience patterns

A chain of synchronous calls is only as available as its weakest link. Protect every call:

  • Timeouts so a slow dependency cannot hold threads forever.
  • Retries with backoff and jitter, only for idempotent operations.
  • Circuit breakers that stop calling a failing service for a while and fail fast instead.
  • Bulkheads that limit how many resources one dependency can use.
  • Fallbacks, such as cached data, when a non-critical service is down.

Services find each other through service discovery, such as Kubernetes DNS names, rather than fixed IP addresses.

API gateway and service mesh

What a service mesh addsService meshproxies beside eachservicemTLSencrypt and identifyRetriesand timeoutsTraffic splitcanary releasesTelemetrymetrics, tracesPolicywho may call whom
Figure 2. A mesh moves networking concerns out of application code into a shared layer.

An API gateway handles north-south traffic from clients: routing, authentication, rate limiting and request shaping. A service mesh, such as Istio or Linkerd, handles east-west traffic between services, typically with a sidecar proxy beside each service, or in newer designs a shared per-node proxy. It provides mutual TLS (mTLS), retries, traffic splitting for canary releases, and consistent metrics and traces without changing application code.

Tip: a mesh adds operational complexity. For a handful of services, libraries and a gateway may be enough; meshes pay off as service count and security needs grow.

From a security view, mTLS in a mesh gives each workload a verifiable identity, which supports zero trust policies such as "only the checkout service may call payments".

Practice

Why is gRPC often preferred for internal calls?
It uses compact binary Protocol Buffers over HTTP/2, supports streaming and generates typed client code from a shared contract.
What does a circuit breaker do?
After repeated failures it stops sending calls to the dependency for a period and fails fast, giving the dependency time to recover.
What is the difference between an API gateway and a service mesh?
A gateway manages traffic entering from clients (north-south); a mesh manages traffic between services (east-west).

Key takeaways

  • REST suits public APIs; gRPC suits fast internal calls.
  • Events reduce coupling but make flows harder to trace.
  • Use timeouts, safe retries and circuit breakers on every call.
  • Gateways manage client traffic; meshes manage service-to-service traffic.
  • Mesh mTLS gives workloads identity for zero trust policies.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.