Skip to content
SEE Exam Prep

Question 2 of 11 · Set 2 · 6 marks

Open in ChatGPT

Differentiate RPC, RMI, and message-oriented communication. Why is stream-oriented communication unsuitable for every type of distributed application?


Introduction

Three mechanisms let processes on different machines talk: a call that looks local (RPC), a call on a remote object (RMI), and a message handed to a queue (message-oriented middleware). They differ in coupling and in what the sender must know.

RPC: remote procedure call

  • The client calls a stub; the stub marshals the arguments and the runtime sends them. The server stub unmarshals, calls the procedure and returns the result the same way.
  • Coupling: tight. Both sides are running, share an interface, and the call is synchronous.
  • Best for: a request that needs an answer now, with a known service.

RMI: remote method invocation

  • The object-oriented form: the client holds a proxy for a remote object and calls a method on it; the object keeps its state on the server between calls.
  • Coupling: tight, plus object identity: the client needs a reference, obtained from a registry.
  • Best for: stateful services and distributed objects (Java RMI, CORBA).

MOM: message-oriented middleware

  • The sender places a message in a queue or on a topic; the receiver takes it when it is ready.
  • Coupling: loose, in time and in identity. The sender does not need the receiver to be running, and does not wait.
  • Best for: decoupling, buffering, and fan-out to several consumers (Kafka, RabbitMQ).

Comparison

Point RPC RMI MOM
Interaction Synchronous call Synchronous method call Asynchronous message
State Stateless Object state on server Message state in queue
Coupling Interface + time Interface + object + time Message format only
Failure handling Timeout and retry Timeout and retry Queue buffers and redelivers

Stream-oriented communication

Streams (audio, video, TCP byte streams) carry a continuous flow with timing constraints. They are unsuitable for every application because:

  1. No request-reply structure: nothing identifies an individual "call" or its result.
  2. Timing matters more than integrity: a late frame is worthless, but a stream cannot prioritise a later one.
  3. Buffering and jitter: the receiver needs a play-out buffer, which a simple API call cannot express.
  4. Not idempotent: a retransmitted frame arrives after its successor and must be dropped, which needs sequence numbers and a policy.

Conclusion

Choose RPC for a synchronous call with an answer, RMI when the remote entity holds state, MOM when the sender must not wait, and streams only when the data is continuous and timing is part of the contract.