0% found this document useful (0 votes)
32 views13 pages

Message Passing vs RPC in Distributed Systems

The document compares Message Passing and Remote Procedure Call (RPC) in distributed systems, highlighting their key characteristics and use cases. Message Passing is asynchronous and decoupled, while RPC is synchronous and tightly coupled, with distinct advantages for different scenarios. A hybrid approach is often employed in modern systems to leverage the strengths of both communication paradigms.

Uploaded by

Wandera Jonah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views13 pages

Message Passing vs RPC in Distributed Systems

The document compares Message Passing and Remote Procedure Call (RPC) in distributed systems, highlighting their key characteristics and use cases. Message Passing is asynchronous and decoupled, while RPC is synchronous and tightly coupled, with distinct advantages for different scenarios. A hybrid approach is often employed in modern systems to leverage the strengths of both communication paradigms.

Uploaded by

Wandera Jonah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

GROUP 9

NAME REG_NO
LWANGA CYRUS 23/U/ITE/07746/PE

MASENGERE OWEN 23/U/ITD/07877/PD

LEJJU LEVI BLESSED 23/U/ITE/15322/PE

OGWAPIT ERICK 23/U/ITE/2415/PE

WANDERA JONAH 23/U/ITE/13409/PE

ASHAKA JOSEPH 23/U/ITE/04363/PE

QUESTION 13
Differentiate between message passing and Remote Procedure Call as used in Distributed Systems
essage Passing vs RPC
ommunication Paradigms in Distributed Systems

Message Passing Remote Procedure Call


Asynchronous, decoupled communication Synchronous, direct procedure execution

October 31, 2025


What Are They?

Message Passing Remote Procedure Call


An asynchronous communication model A synchronous communication model that
where processes exchange data by sending enables a program to execute a procedure on a
and receiving messages. remote server as if it were local.

Processes are decoupled and don't block each Processes are directly linked during the call
other
Follows a request-response pattern
Messages are typically placed in queues or
Caller waits for server to process and respond
channels

Sender doesn't wait for immediate response

"Think of it as sending a letter in the mail system" "Think of it as making a phone call to get something done"

Communication Paradigms in Distributed Systems 2/12


Message Passing Basics

Key Concepts Message Flow

Asynchronous: Senders don't wait for


immediate responses

Decoupled: Processes operate


independently

Message-based: Data exchanged as


messages

Messages are placed into queues or channels,


allowing senders to continue execution without
blocking.

Communication Paradigms in Distributed Systems 3/12


How Message Passing Works
Message Passing involves three core steps that enable asynchronous communication

1. Message 2. Message 3. Message


Creation Transmission Retrieval
Sender constructs a message Sender dispatches message Receiver gets message when
with data to a channel/queue ready

Asynchronous Decoupled Reliable


Sender doesn't wait for immediate Sender and receiver operate independently Messages can be queued and processed
response later

Communication Paradigms in Distributed Systems 4/12


Message Passing Examples

Kafka at Uber RabbitMQ at Reddit


Message streaming platform Message queue system

Used For: Used For:


Handling massive data streams Asynchronous task processing

Log aggregation Comment processing


Activity tracking Worker processes

Real-time analytics
Implementation:
Implementation: When a user submits a comment, it's placed in a RabbitMQ
queue, allowing worker processes to handle it independently,
Uber leverages Kafka for both batch and real-time
ensuring the web application remains responsive.
processing, employing tiered storage for efficient data
management.

Key Scalable, resilient data processing for mobile Key Decouples comment submission from
Benefit: app users Benefit: processing

Message Passing in Action 5/12


RPC Basics

What is RPC? How RPC Works (Basic Concept)


Remote Procedure Call (RPC) is a
synchronous communication model that
enables a program to execute a procedure on a
remote server as if it were a local function call.

Key Characteristics:

Synchronous: Caller waits for server to process


and respond

Abstraction: Hides network communication


complexities The RPC Process:
1 Client calls local "stub" function
Familiar: Uses local function call semantics
2 Parameters are marshaled (serialized)
Request-Response: Direct call with immediate
3 Request sent over network
feedback
4 Server unmarshals parameters
5 Procedure executes and returns result
How RPC Works

Client Server
Calls remote function Request Response Processes request

1 2 3 4 5 6 7

Client Parameter Request Server-side Procedure Result Client-side


Invocation Marshaling Transmission Unmarshaling Execution Marshaling Unmarshaling
Calls local stub Serializes Sends over network Receives and Calls actual Prepares result Receives and
function parameters unmarshals procedure returns

Key Characteristics
Synchronous, blocking nature Direct connection between client and server Request-response communication pattern

Communication Paradigms in Distributed Systems 7/12


RPC Examples

Blockchain
Netflix Microservices
Systems

gRPC Implementation JSON-RPC Implementation Service-to-Service


Netflix uses gRPC for efficient JSON-RPC is widely adopted in Communication
microservices communication, blockchain applications for: Microservices architectures
particularly for: commonly use RPC for:
Node-to-node communication
Fetching user preferences within distributed ledger systems Synchronous service-to-service
interactions
Delivering personalized content Lightweight, stateless protocol
recommendations with JSON for data exchange Remote procedure calls between
different service boundaries
Leveraging Protocol Buffers for Enabling simple and efficient
efficient serialization transaction processing Example: Product service calling
user service to verify credentials

JSON-RPC provides a simple, human- RPC enables clear service boundaries


gRPC provides low-latency communication readable interface for blockchain while providing synchronous
between services operations communication

Communication Paradigms in Distributed Systems 8/12


Key Differences

The fundamental distinctions between Message Passing and Remote Procedure Call

Aspect
Message Passing Remote Procedure Call

Communication Style
Asynchronous, non-blocking Synchronous, blocking

Coupling
Loose coupling Tight coupling

Failure Handling
Receiver downtime is manageable Caller must handle immediate failure

Data Flow
Event-driven, reactive Command-driven, procedural

Reliability Focus
Message durability and guaranteed delivery Request-response guarantees

Communication Paradigms in Distributed Systems 9/12


When To Use Each

Use RPC When: Use Message Passing When:

Immediate Response Needed High Volume & Reliability


Synchronous interactions where the caller expects a Scalable systems requiring message durability and
direct result guaranteed delivery

Tight Coordination Required Decoupled Architecture


Scenarios needing immediate feedback and Systems where producers and consumers operate
coordination between services independently

Real-time User Interactions Event-Driven Processes


Fetching user preferences or critical business logic Log aggregation, activity tracking, and event sourcing
where real-time results are essential where immediate processing isn't critical

Lower latency for individual requests Better for absorbing traffic bursts and backpressure

Communication Paradigms in Distributed Systems 10/12


Combined Approach

Modern distributed systems often use a hybrid approach, leveraging both Message Passing and RPC to
optimize for different interaction patterns.

Message Passing Remote Procedure Call


Used for high-volume, event-driven processes Used for synchronous, low-latency interactions
Enables decoupling producers from consumers Enables direct service-to-service communication

Communication Paradigms in Distributed Systems 11/12


Summary

The choice between Message Passing and RPC depends on your system's requirements:

Choose RPC for: Choose Message Passing for:


Immediate responses and tight coordination System resilience and handling failures

Synchronous workflows where caller expects a direct Decoupled workflows and high-volume processing
result
Event-driven architectures where immediate
Scenarios requiring real-time interactions processing isn't critical

Hybrid Approach
Modern systems often combine both approaches. For example, Spotify uses gRPC for synchronous communication and Apache
Kafka for asynchronous event streaming.

Communication Paradigms in Distributed Systems 12/12

You might also like