liveBook · Manning

Interprocess communication

As explained in Microservices Patterns, Second Edition

Interprocess communication is the exchange of data or control between independently executing processes through mechanisms such as network calls or message passing.

Interprocess communication (IPC) exchanges data or control across process boundaries. In a microservice architecture, services use IPC to collaborate on distributed operations; clients also use it to reach services. A monolith uses IPC to communicate with external systems, but its internal elements interact through language-level calls. section 8.0

Choosing an IPC mechanism affects availability, performance, runtime coupling, and transaction management. Synchronous request/response mechanisms such as REST or gRPC are alternatives to asynchronous messaging through brokers such as Kafka or RabbitMQ. section 8.0 section 8.1

Choose a communication style with its operational consequences in view:

  • Synchronous remote procedure invocation is comparatively easy to use, but a slow or unavailable service can cause failures to cascade. Clients need partial-failure handling, including a circuit breaker. section 8.4
  • Asynchronous messaging can reduce runtime coupling. Design around messages and channels, then select messaging infrastructure according to requirements such as ordering and delivery guarantees. section 8.4
  • Synchronous clients need service discovery to locate instances. Platform-provided discovery is the simplest approach; application-level discovery requires more work but can handle services on multiple deployment platforms. section 8.4

Coordinating a database update and message

A transaction outbox writes a message to the database as part of the transaction that updates business data. A separate process retrieves it using polling or transaction log tailing and sends it to the message broker. section 8.4

Message payload format affects efficiency, API usability, and evolvability. Use a cross-language format rather than language-specific serialization. Text formats such as JSON and XML are human-readable and self-describing, but can be verbose and costly to parse; binary formats are compact and fast to process but require more tooling. Some mechanisms dictate the format. section 8.1.6

Table 8.3 The benefits and drawbacks of text-based vs. binary formats for message payloads

Format

Benefits

Drawbacks

Text

  • Human-readable
  • Simple to process
  • Self descriptive
  • Verbose
  • Inefficient to process large messages

Binary

  • Compact
  • Fast to process
  • Requires more tooling
  • Not human-readable

Compare the benefits and drawbacks of text and binary payload formats. section 8.1.6

IPC design also includes API definition and evolution, security, and client design. For a distributed system, consider transactional messaging, resilience, discovery, and external client access alongside the communication style. section 7.6.2 section 8.1

How Microservices Patterns, Second Edition covers it

How deep it goes
Compares communication styles and payload formats, and explains resilience, discovery, and transaction outbox choices.
Examples
Uses REST, gRPC, Kafka, RabbitMQ, and a transaction outbox to illustrate IPC mechanisms and coordination.
What you can do after
Evaluate/understand IPC alternatives against availability, coupling, resilience, and messaging requirements.
How it connects
Connects IPC to runtime coupling, service discovery, circuit breakers, transaction management, and API evolution.

Also explained in

Compare how 3 books explain interprocess communication →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.