Inspirel - RPC vs Messaging (2024)

Introduction

In the area of distributed programming there are several established approaches for solving the problem of communication between separate programs.

Within the wide range of solutions, from low-level socket operations to high-level and domain-specific information exchange systems, two "middle-level" approaches are particularly interesting as they hide implementation details at the same time offering a generic interface that can be deployed in a variety of application domains. These two solutions are RPC-oriented communication and messaging.

This article tries to highlight the essential difference between these two communication approaches.

The opportunities and traps of RPC

RPC, which stands for Remote Procedure Calls, is a concept that tries to generalize a regular procedure invocation to a case where caller and receiver do not reside in the same process - and are potentially distributed across separate machines.

The essential goal of this approach is to make remote invocation as similar as possible to regular procedure calls and to hide the details of the physical connection.

This goal is very compelling in that it potentially allows to turn the distribution of the final system into a deployment-time decision - in other words, that from the programmer's perspective it does not matter whether the call is local or remote as long as it syntactically looks the same, and the final decision about the distribution of individual system components can be made later. Removing the distribution aspect from the code can be very beneficial for the project if at its early stages the final details of its deployment are not fully known.

The potential benefits of RPC have their costs, however, and they mainly come from the fact that the syntax of regular calls leaves no place for the information that might be usefully used if the system is actually distributed. Regular procedure calls, as known from mainstream programming languages, provide only a simplified notion of the call that assumes several "facts":

  • The mechanics of the actual call (that is, transfer of execution from the caller to the receiver) can be neglected in terms of its run-time costs.
    Even though some programming languages, like C++, can make the programmer vigilant with respect to the potential cost of parameter passing, the whole idea of procedure call is that the execution just transfers to the called subprogram or function and continues there, until it just returns back to the point of call. This perception of "free call" invites programmers to refactor their code into many, but smaller procedures and functions. That low cost, improved even further by compile-time inlining, fits well into languages that do not provide any means for monitoring the execution cost of the call.
  • The recipient of the call is an inherent and logical part of the same system.
    This assumption itself has several security and integrity consequences. First, many programming languages provide no security-related tools for managing procedure calls - every call is assumed to be safe. Second, in the statically-typed language, the programmer is reassured by the compiler that the signature and the protocol of the call matches on both sides. Neither of these assumptions is guaranteed to be true in a distributed system (see also the What Is Wrong With IDL article for a wider coverage of related problems).

The problem with RPC is that by hiding the fact of distribution at the syntax level, it makes it more difficult for the programmer to properly address the inherent challenges that come with the physical aspects of distribution.

Messaging as an alternative

Messaging as a communication concept is very much different from RPC in that it does not attempt to hide the physical aspects of communication. It is still trying to hide the implementation details, but not to the point of dismissing the notions related to run-time costs of exchanging data.

Messaging as a communication concept can be easily explained due to its similarities to the e-mail system. The most important of these similarities is the fact that messages are recognized as first-class entities, and that users think of each message as something tangible that is acted upon. The focus here is not on hiding, where the communication and its challenges are not visible at all - but rather on encapsulation, where the fact of communication is exposed in a form that the user can interact with. In the e-mail analogy, a message is something that is not only transmitted, but something that can be also backed-up or printed.

Following is a non-exhaustive list of opportunities that can be, depending on implementation, exposed as regular functional features of a messaging system:

  • Ability to manage and react to communication delays. A messaging system can have timeouts that are controlled with arbitrary granularity - even at the level of individual messages.
  • Ability to monitor the progress (and to estimate the actual time) of physical data transfer.
  • Message priorities that allow the transport layer to differentiate messages based on their importance.
  • Message persistency - a messaging system might have a possibility to store messages for reliability or to allow complete decoupling of senders and receivers in terms of their execution time. Back-ups also provide a possible application of message persistency.
  • Exploratory and dynamic interpretation of message content - messages can have bodies that do not necessarily conform to any statically agreed structure, which provides more flexibility in managing evolution of a distributed system (again, see What Is Wrong With IDL for more details)
  • Ability to adapt to both direct and indirect transport systems, including those with automated replication of content. In the e-mail analogy, mailing lists (with archives, thanks to message persistency) are good examples of indirect transport systems that do not require any extensions to the basic concepts of e-mail.
  • Message tagging, meta-information and tracing - it is possible, for example, to obtain a full report of the transport path that was "visited" by the message until it finally reached its destination. Thanks to the meta-information, messages can also become parts of higher-level communication structures. In the e-mail analogy so-called "threads" in discussion groups show a possible application of these concepts.
  • Security-related features like digital signatures of data content and access tokens can be used on a per-message basis for detailed control of who can do what in the distributed system.

The above list of possible features shows that what is considered to be a deployment detail in the RPC approach, is turned into a wide range of functional opportunities in the messaging approach.

It is still possible to use messaging as a distributed implementation of the "call" and in fact object-oriented methodology uses the term "message" to refer to requests that can be sent between objects. The advantage of messaging, however, is that by exposing the fact of communication in a tangible form of the message as a first-class entity, the programmer gains the opportunities for expansion into the functional areas that are either uncomfortable within the constraints of a "procedure call mindset" or just not possible at all.

Inspirel - RPC vs Messaging (2024)

FAQs

What are the advantages of messaging over RPC? ›

The advantage of messaging, however, is that by exposing the fact of communication in a tangible form of the message as a first-class entity, the programmer gains the opportunities for expansion into the functional areas that are either uncomfortable within the constraints of a "procedure call mindset" or just not ...

What is the difference between message passing and RPC? ›

RPC provides a higher-level abstraction than shared memory or message passing, as it enables processes to communicate using a procedure call interface. Signals: Signals are a mechanism for interprocess communication in Unix-based systems.

What are the downsides of RPC? ›

Though RPC boasts a wide range of benefits, users should also be aware of the following pitfalls: The client and server use different execution environments for their respective routines, and the use of resources is more complex. Consequently, RPC systems aren't always suited for transferring large amounts of data.

How is RPC different from message oriented middleware? ›

RPC is a better choice when the service provider's response is small, thus creating a negligible penalty for suspending execution while waiting for a reply. MOM-based communication works better for long-lived transactions that require long execution times from the SP.

Why is RPC better? ›

RPC tends to be more tightly coupled, with direct function calls, whereas REST emphasizes loose coupling and scalability through its uniform interface. RPC: Enables remote execution of functions on a server. REST: Relies on stateless communication via standard HTTP methods.

What is the major disadvantage of using RPCs in comparison to messaging as in message queuing systems? ›

Whereas RPCs are synchronous and unreliable, message queues are asynchronous and reliable. They add complexity both to application design and operations, but that complexity can be managed.

What are the two types of RPC messages? ›

This section explains the RPC message protocol. The Remote Procedure Call (RPC) message protocol consists of two distinct structures: the call message and the reply message (see RPC Call Message and RPC Reply Message).

Is RPC same as TCP? ›

TCP (Transmission Control Protocol) is a delivery protocol (i.e. how can we have a conversation between two places). RPC (Remote Procedure Call) describes how the messages should be treated (i.e. how each side should talk).

How is RPC different from HTTP? ›

In Remote Procedure Call (RPC), the client uses HTTP POST to call a specific function by name. Client-side developers must know the function name and parameters in advance for RPC to work. In REST, clients and servers use HTTP verbs like GET, POST, PATCH, PUT, DELETE, and OPTIONS to perform options.

When not to use RPC? ›

Because of RPC's disadvantages, you may not want to use RPC if you are building an API where one critical focus is that it can be easily browsed and discovered by your consumers.

What are the problems with RPC? ›

Common causes for an RPC failure can be network connectivity issues, interrupted RPC service, firewall issues, etc.

What are the two scenarios under which an RPC might fail? ›

If the client is unable to find the server, then the client should return an error message. If client and server both are running but something goes wrong on the network and RPC request packet doesn't reach the server for processing or the server sent the reply back to client but client never received the reply.

Why is RPC used in Microservices? ›

In the ever-evolving landscape of microservices architecture, communication between services is a critical aspect that demands attention. Remote Procedure Call (RPC) is a paradigm that allows one service to invoke a function or method on another service, creating a seamless flow of data and functionality.

Why use message oriented middleware? ›

Message-oriented middleware (MOM) allows applications to communicate and exchange data by sending and receiving messages. With advantages of asynchronous and multi-point transmission, loosely coupling between participants etc.

What is the difference between RPC and REST in Microservices? ›

REST is generally more suited for web services and public APIs where scalability, caching, and a uniform interface are important. RPC is often chosen for actions that are tightly coupled to server-side operations, especially when efficiency and speed are critical, as in internal microservices communication.

What are several advantages of using a message queue compared to direct RPC? ›

Systems built on message queues don't do load shedding like RPC systems because they have storage on disk to store incoming requests as they come in. This makes a queue-based system more resilient under a higher load than an RPC system. Instead of using threads and memory to hold onto requests, it uses durable disks.

What are the advantages and disadvantages of messaging? ›

9. SMS Pros and Cons
AdvantagesDisadvantages
Can save time sending a message rather than interrupting someone with a phone callNeeds basic typing skills
Good for informal messagesCan take some time to compile a message if you are not familiar with text speak shortcuts
4 more rows

What are the advantages of message passing in interprocess communication? ›

Advantages of Message Passing Model :
  • Easier to implement.
  • Quite tolerant of high communication latencies.
  • Easier to build massively parallel hardware.
  • It is more tolerant of higher communication latencies.
  • Message passing libraries are faster and give high performance.
May 15, 2023

Top Articles
Test a macro by using Single Step mode
Video Relay Service (VRS)
AllHere, praised for creating LAUSD’s $6M AI chatbot, files for bankruptcy
Noaa Charleston Wv
Terrorist Usually Avoid Tourist Locations
Hk Jockey Club Result
What Auto Parts Stores Are Open
Acbl Homeport
Our History | Lilly Grove Missionary Baptist Church - Houston, TX
Giovanna Ewbank Nua
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Blog:Vyond-styled rants -- List of nicknames (blog edition) (TouhouWonder version)
Lenscrafters Huebner Oaks
Directions To O'reilly's Near Me
Moparts Com Forum
Guilford County | NCpedia
Leader Times Obituaries Liberal Ks
Images of CGC-graded Comic Books Now Available Using the CGC Certification Verification Tool
Blackwolf Run Pro Shop
Convert 2024.33 Usd
How pharmacies can help
Qhc Learning
1973 Coupe Comparo: HQ GTS 350 + XA Falcon GT + VH Charger E55 + Leyland Force 7V
Jail View Sumter
Xfinity Cup Race Today
Panola County Busted Newspaper
Surplus property Definition: 397 Samples | Law Insider
Bn9 Weather Radar
Inkwell, pen rests and nib boxes made of pewter, glass and porcelain.
Timeline of the September 11 Attacks
Tu Housing Portal
031515 828
Tripcheck Oregon Map
County Cricket Championship, day one - scores, radio commentary & live text
Goodwill Thrift Store & Donation Center Marietta Photos
Midsouthshooters Supply
Page 5662 – Christianity Today
Encompass.myisolved
Anhedönia Last Name Origin
More News, Rumors and Opinions Tuesday PM 7-9-2024 — Dinar Recaps
Craigslist - Pets for Sale or Adoption in Hawley, PA
Lake Andes Buy Sell Trade
VPN Free - Betternet Unlimited VPN Proxy - Chrome Web Store
Cleveland Save 25% - Lighthouse Immersive Studios | Buy Tickets
What Is The Optavia Diet—And How Does It Work?
RubberDucks Front Office
Bismarck Mandan Mugshots
Model Center Jasmin
Craigslist Cars And Trucks For Sale By Owner Indianapolis
Bumgarner Funeral Home Troy Nc Obituaries
Cataz.net Android Movies Apk
Latest Posts
Article information

Author: Kerri Lueilwitz

Last Updated:

Views: 6042

Rating: 4.7 / 5 (47 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Kerri Lueilwitz

Birthday: 1992-10-31

Address: Suite 878 3699 Chantelle Roads, Colebury, NC 68599

Phone: +6111989609516

Job: Chief Farming Manager

Hobby: Mycology, Stone skipping, Dowsing, Whittling, Taxidermy, Sand art, Roller skating

Introduction: My name is Kerri Lueilwitz, I am a courageous, gentle, quaint, thankful, outstanding, brave, vast person who loves writing and wants to share my knowledge and understanding with you.