MicroservicesInterprocess Communication (IPC)
tamerrezk82
1
Table of Contents
Introduction...............................................................................................................................2
Interaction Styles.......................................................................................................................3
IPC Technologies........................................................................................................................4
1. Asynchronous, Message-Based Communication..........................................................4
PROS...................................................................................................................................5
CONS ..................................................................................................................................5
2. Synchronous, Request/Response IPC............................................................................5
REST ...................................................................................................................................5
PROS...................................................................................................................................6
CONS ..................................................................................................................................7
Summary....................................................................................................................................7
2
Introduction
In a monolithic application, components invoke one another via language-level method or
function calls. A microservices-based application is a distributed system running on multiple
machines. Each service instance is typically a process. Consequently, as the following
diagram shows, services must interact using an inter-process communication (IPC)
mechanism.
Figure 1: Interprocess Communication Monoloth VS Micrososervices1
1
https://twitter.com/nginx
3
Interaction Styles
When selecting an IPC mechanism for a service, it is useful to think first about how services
interact. There are a variety of client⇔service interaction styles. They can be categorized
along two dimensions. The first dimension is whether the interaction is one-to-one or one-
to-many, the second dimension is whether the interaction is synchronous or asynchronous.
One-to-One One-to-Many
Synchronous Request/response —
Asynchronous Notification Publish/subscribe
Request/async response Publish/async responses
Table 1 : Interprocess communication styles 2
There are the following kinds of one-to-one interactions:
 Request/response: A client makes a request to a service and waits for a response.
The client expects the response to arrive in a timely fashion. In a thread-based
application, the thread that makes the request might even block while waiting.
 Notification: A client sends a request to a service but no reply is expected or sent.
 Request/async response: A client sends a request to a service, which replies
asynchronously. The client does not block while waiting and is designed with the
assumption that the response might not arrive for a while.
There are the following kinds of one-to-many interactions:
 Publish/subscribe: A client publishes a notification message, which is consumed by
zero or more interested services.
 Publish/Async responses: A client publishes a request message and then waits a
certain amount of time for responses from interested services.
2
https://dzone.com/articles/building-microservices-inter-process-communication-2
4
Figure 2: Interprocess Communication Monoloth VS Micrososervices3
Figure 2 displays TRIP management system in which services use a combination of
notifications, request/response, and publish/subscribe. For example, the passenger’s
smartphone sends a notification to the Trip Management service to request a pickup. The
Trip Management service verifies that the passenger’s account is active by using
request/response to invoke the Passenger Service. The Trip Management service then
creates the trip and uses publish/subscribe to notify other services including the Dispatcher,
which locates an available driver.
IPC Technologies
There are lots of different IPC technologies to choose from. Services can use synchronous
request/response-based communication mechanisms such as HTTP-based REST or Thrift.
Alternatively, they can use asynchronous, message-based communication mechanisms such
as RABBITMQ
1. Asynchronous, Message-Based Communication
When using messaging, processes communicate by asynchronously exchanging messages. A
client makes a request to a service by sending it a message. If the service is expected to
reply, it does so by sending a separate message back to the client. Since the communication
is asynchronous, the client does not block waiting for a reply. Instead, the client is written
assuming that the reply will not be received immediately.
3
https://dzone.com/articles/building-microservices-inter-process-communication-2
5
Message consists of headers (metadata such as the sender) and a message body. Messages
are exchanged over channels. Any number of producers can send messages to a channel.
Similarly, any number of consumers can receive messages from a channel. There are two
kinds of channels, point-to-point (ONE TO ONE) and publish-subscribe(ONE TO MANY).
PROS
 Decouples the client from the service
 Message buffering
 Flexible client-service interactions
CONS
 Additional operational complexity
 Complexity of implementing request/response-based interaction
2. Synchronous, Request/Response IPC
When using a synchronous, request/response-based IPC mechanism, a client sends a
request to a service. The service processes the request and sends back a response.
There are numerous protocols to choose from. Two popular protocols are REST and Thrift.
REST
REST is an IPC mechanism that (almost always) uses HTTP. Roy Fielding, the creator of REST,
defines REST as follows:
REST provides a set of architectural constraints that, when applied as a whole, emphasizes
scalability of component interactions, generality of interfaces, independent deployment of
components, and intermediary components to reduce interaction latency, enforce security,
and encapsulate legacy systems4.
Leonard Richardson defines a very useful maturity model for REST that consists of the
following levels.
 Level 0 – Clients of a level 0 API invoke the service by making HTTP POST requests to
its sole URL endpoint. Each request specifies the action to perform, the target of the
action (e.g. the business object), and any parameters.
 Level 1 – A level 1 API supports the idea of resources. To perform an action on a
resource, a client makes a POST request that specifies the action to perform and any
parameters.
4
Microservices Patterns, Chris Richardson
6
 Level 2 – A level 2 API uses HTTP verbs to perform actions: GET to retrieve, POST to
create, and PUT to update. The request query parameters and body, if any, specify
the action’s parameters. This enables services to leverage web infrastructure such as
caching for GET requests.
 Level 3 – The design of a level 3 API is based on the terribly named HATEOAS. The
basic idea is that the representation of a resource returned by a GET request
contains links for performing the allowable actions on that resource. For example, a
client can cancel an order using a link in the Order representation returned in
response to the GET request sent to retrieve the order.
Benefits of HATEOAS include no longer having to hardwire URLs into client code.
Another benefit is that because the representation of a resource contains links to the
allowable actions, the client doesn’t have to guess what actions can be performed on
a resource in its current state.
Figure 3: The levels of maturity according to Richardson’s model5
PROS
 HTTP is simple and familiar.
 You can test an HTTP API from within a browser using an extension such
as Postman or from the command line using curl (assuming JSON or some other text
format is used).
 It directly supports request/response-style communication.
 HTTP is, of course, firewall-friendly.
 It doesn’t require an intermediate broker, which simplifies the system’s architecture.
5
https://restfulapi.net/richardson-maturity-model/
7
CONS
 It only directly supports the request/response style of interaction. You can use HTTP
for notifications but the server must always send an HTTP response.
 Because the client and service communicate directly (without an intermediary to
buffer messages), they must both be running for the duration of the exchange.
 The client must know the location (i.e., the URL) of each service instance. As
described in the previous article about the API Gateway, this is a non-trivial problem
in a modern application. Clients must use a service discovery mechanism to locate
service instances.
Summary
Microservices must communicate using an inter-process communication mechanism. When
designing how your services will communicate, you need to consider various issues: how
services interact, how to specify the API for each service, how to evolve the APIs, and how
to handle partial failure. There are two kinds of IPC mechanisms that microservices can use,
asynchronous messaging and synchronous request/response.

More Related Content

PDF
Cloud Computing - An Introduction
DOCX
Icloud seminar report
PPTX
Artificial Intelligence for Disaster Response
PPTX
Fog computing
PPTX
Research in Cloud Computing
PPTX
iCloud
PDF
Fog Computing with VORTEX
PDF
Literature Review: Security on cloud computing
Cloud Computing - An Introduction
Icloud seminar report
Artificial Intelligence for Disaster Response
Fog computing
Research in Cloud Computing
iCloud
Fog Computing with VORTEX
Literature Review: Security on cloud computing

What's hot (13)

DOCX
Assignment on Cloud Computing
PDF
The A-Z of Data: Introduction to MLOps
PDF
Big data on google cloud
PPTX
Machine Learning on AWS
PDF
How Can AI and IoT Power the Chemical Industry?
PDF
KA1053 Dasar Pemrograman Macro Excel
PDF
Internet of Things (IOT) - Technology and Applications
PPT
Cloud management (IBM)
PPTX
Cloud Computing(Introduction)
PPT
Cloud computing
PPTX
Azure WAf
PPT
INTRODUCTION TO CLOUD COMPUTING
PPTX
Cloud computing and Cloudsim
Assignment on Cloud Computing
The A-Z of Data: Introduction to MLOps
Big data on google cloud
Machine Learning on AWS
How Can AI and IoT Power the Chemical Industry?
KA1053 Dasar Pemrograman Macro Excel
Internet of Things (IOT) - Technology and Applications
Cloud management (IBM)
Cloud Computing(Introduction)
Cloud computing
Azure WAf
INTRODUCTION TO CLOUD COMPUTING
Cloud computing and Cloudsim
Ad

Similar to Inter process communication (20)

PPTX
Intro to Microservices Architecture
PDF
09-01-services-slides.pdf for educations
PPTX
TECHPOD Meetup 3 - inter-service-communication-microservices
PDF
OptiSol Microservices Architecture - Tech Meetup
PPTX
REST & RESTful Web Service
DOCX
RabbitMQ in Microservice Architecture.docx
PDF
Micro-service architectures with Gilmour
PPTX
Tef con2016 (1)
PPTX
Main Groups of Microservices
PDF
REST vs. Messaging For Microservices
PDF
Resilient and Adaptable Systems with Cloud Native APIs
PDF
Microservices Architecture For Conversational Intelligence Platform
PPTX
Microservices-101
PDF
Building asynchronous micro-services that get along
PDF
Web 7 | HTTP Request and Response
PDF
[WSO2Con EU 2017] Building Next Generation Banking Middleware at ING: The Rol...
PDF
#JaxLondon keynote: Developing applications with a microservice architecture
PDF
Developing Applications with a Micro Service Architecture - Chris Richardson
PDF
Microservices designing deploying
PDF
Microservices designing deploying
Intro to Microservices Architecture
09-01-services-slides.pdf for educations
TECHPOD Meetup 3 - inter-service-communication-microservices
OptiSol Microservices Architecture - Tech Meetup
REST & RESTful Web Service
RabbitMQ in Microservice Architecture.docx
Micro-service architectures with Gilmour
Tef con2016 (1)
Main Groups of Microservices
REST vs. Messaging For Microservices
Resilient and Adaptable Systems with Cloud Native APIs
Microservices Architecture For Conversational Intelligence Platform
Microservices-101
Building asynchronous micro-services that get along
Web 7 | HTTP Request and Response
[WSO2Con EU 2017] Building Next Generation Banking Middleware at ING: The Rol...
#JaxLondon keynote: Developing applications with a microservice architecture
Developing Applications with a Micro Service Architecture - Chris Richardson
Microservices designing deploying
Microservices designing deploying
Ad

Recently uploaded (20)

PDF
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
PPTX
Download Adobe Photoshop Crack 2025 Free
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
Lecture 5 Software Requirement Engineering
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PPTX
Cybersecurity: Protecting the Digital World
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PPTX
Tech Workshop Escape Room Tech Workshop
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
PDF
Microsoft Office 365 Crack Download Free
PDF
MCP Security Tutorial - Beginner to Advanced
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
Guide to Food Delivery App Development.pdf
PPTX
Trending Python Topics for Data Visualization in 2025
Multiverse AI Review 2025: Access All TOP AI Model-Versions!
Download Adobe Photoshop Crack 2025 Free
iTop VPN Crack Latest Version Full Key 2025
Lecture 5 Software Requirement Engineering
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
Cybersecurity: Protecting the Digital World
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Full-Stack Developer Courses That Actually Land You Jobs
Tech Workshop Escape Room Tech Workshop
CNN LeNet5 Architecture: Neural Networks
DNT Brochure 2025 – ISV Solutions @ D365
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
Microsoft Office 365 Crack Download Free
MCP Security Tutorial - Beginner to Advanced
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Guide to Food Delivery App Development.pdf
Trending Python Topics for Data Visualization in 2025

Inter process communication

  • 2. 1 Table of Contents Introduction...............................................................................................................................2 Interaction Styles.......................................................................................................................3 IPC Technologies........................................................................................................................4 1. Asynchronous, Message-Based Communication..........................................................4 PROS...................................................................................................................................5 CONS ..................................................................................................................................5 2. Synchronous, Request/Response IPC............................................................................5 REST ...................................................................................................................................5 PROS...................................................................................................................................6 CONS ..................................................................................................................................7 Summary....................................................................................................................................7
  • 3. 2 Introduction In a monolithic application, components invoke one another via language-level method or function calls. A microservices-based application is a distributed system running on multiple machines. Each service instance is typically a process. Consequently, as the following diagram shows, services must interact using an inter-process communication (IPC) mechanism. Figure 1: Interprocess Communication Monoloth VS Micrososervices1 1 https://twitter.com/nginx
  • 4. 3 Interaction Styles When selecting an IPC mechanism for a service, it is useful to think first about how services interact. There are a variety of client⇔service interaction styles. They can be categorized along two dimensions. The first dimension is whether the interaction is one-to-one or one- to-many, the second dimension is whether the interaction is synchronous or asynchronous. One-to-One One-to-Many Synchronous Request/response — Asynchronous Notification Publish/subscribe Request/async response Publish/async responses Table 1 : Interprocess communication styles 2 There are the following kinds of one-to-one interactions:  Request/response: A client makes a request to a service and waits for a response. The client expects the response to arrive in a timely fashion. In a thread-based application, the thread that makes the request might even block while waiting.  Notification: A client sends a request to a service but no reply is expected or sent.  Request/async response: A client sends a request to a service, which replies asynchronously. The client does not block while waiting and is designed with the assumption that the response might not arrive for a while. There are the following kinds of one-to-many interactions:  Publish/subscribe: A client publishes a notification message, which is consumed by zero or more interested services.  Publish/Async responses: A client publishes a request message and then waits a certain amount of time for responses from interested services. 2 https://dzone.com/articles/building-microservices-inter-process-communication-2
  • 5. 4 Figure 2: Interprocess Communication Monoloth VS Micrososervices3 Figure 2 displays TRIP management system in which services use a combination of notifications, request/response, and publish/subscribe. For example, the passenger’s smartphone sends a notification to the Trip Management service to request a pickup. The Trip Management service verifies that the passenger’s account is active by using request/response to invoke the Passenger Service. The Trip Management service then creates the trip and uses publish/subscribe to notify other services including the Dispatcher, which locates an available driver. IPC Technologies There are lots of different IPC technologies to choose from. Services can use synchronous request/response-based communication mechanisms such as HTTP-based REST or Thrift. Alternatively, they can use asynchronous, message-based communication mechanisms such as RABBITMQ 1. Asynchronous, Message-Based Communication When using messaging, processes communicate by asynchronously exchanging messages. A client makes a request to a service by sending it a message. If the service is expected to reply, it does so by sending a separate message back to the client. Since the communication is asynchronous, the client does not block waiting for a reply. Instead, the client is written assuming that the reply will not be received immediately. 3 https://dzone.com/articles/building-microservices-inter-process-communication-2
  • 6. 5 Message consists of headers (metadata such as the sender) and a message body. Messages are exchanged over channels. Any number of producers can send messages to a channel. Similarly, any number of consumers can receive messages from a channel. There are two kinds of channels, point-to-point (ONE TO ONE) and publish-subscribe(ONE TO MANY). PROS  Decouples the client from the service  Message buffering  Flexible client-service interactions CONS  Additional operational complexity  Complexity of implementing request/response-based interaction 2. Synchronous, Request/Response IPC When using a synchronous, request/response-based IPC mechanism, a client sends a request to a service. The service processes the request and sends back a response. There are numerous protocols to choose from. Two popular protocols are REST and Thrift. REST REST is an IPC mechanism that (almost always) uses HTTP. Roy Fielding, the creator of REST, defines REST as follows: REST provides a set of architectural constraints that, when applied as a whole, emphasizes scalability of component interactions, generality of interfaces, independent deployment of components, and intermediary components to reduce interaction latency, enforce security, and encapsulate legacy systems4. Leonard Richardson defines a very useful maturity model for REST that consists of the following levels.  Level 0 – Clients of a level 0 API invoke the service by making HTTP POST requests to its sole URL endpoint. Each request specifies the action to perform, the target of the action (e.g. the business object), and any parameters.  Level 1 – A level 1 API supports the idea of resources. To perform an action on a resource, a client makes a POST request that specifies the action to perform and any parameters. 4 Microservices Patterns, Chris Richardson
  • 7. 6  Level 2 – A level 2 API uses HTTP verbs to perform actions: GET to retrieve, POST to create, and PUT to update. The request query parameters and body, if any, specify the action’s parameters. This enables services to leverage web infrastructure such as caching for GET requests.  Level 3 – The design of a level 3 API is based on the terribly named HATEOAS. The basic idea is that the representation of a resource returned by a GET request contains links for performing the allowable actions on that resource. For example, a client can cancel an order using a link in the Order representation returned in response to the GET request sent to retrieve the order. Benefits of HATEOAS include no longer having to hardwire URLs into client code. Another benefit is that because the representation of a resource contains links to the allowable actions, the client doesn’t have to guess what actions can be performed on a resource in its current state. Figure 3: The levels of maturity according to Richardson’s model5 PROS  HTTP is simple and familiar.  You can test an HTTP API from within a browser using an extension such as Postman or from the command line using curl (assuming JSON or some other text format is used).  It directly supports request/response-style communication.  HTTP is, of course, firewall-friendly.  It doesn’t require an intermediate broker, which simplifies the system’s architecture. 5 https://restfulapi.net/richardson-maturity-model/
  • 8. 7 CONS  It only directly supports the request/response style of interaction. You can use HTTP for notifications but the server must always send an HTTP response.  Because the client and service communicate directly (without an intermediary to buffer messages), they must both be running for the duration of the exchange.  The client must know the location (i.e., the URL) of each service instance. As described in the previous article about the API Gateway, this is a non-trivial problem in a modern application. Clients must use a service discovery mechanism to locate service instances. Summary Microservices must communicate using an inter-process communication mechanism. When designing how your services will communicate, you need to consider various issues: how services interact, how to specify the API for each service, how to evolve the APIs, and how to handle partial failure. There are two kinds of IPC mechanisms that microservices can use, asynchronous messaging and synchronous request/response.