📞 Remote Procedure Call (RPC)

Local Procedure Calls

Remote Procedure Calls is when the caller and callee reside on different processes, i.e. cannot access variables from the stack. RMI (remote method invocation) is the same idea, but specifically for object-oriented programming.

image.png

RPCs come with many failures, hard to guarantee exactly-once semantics

RPC Semantics

RPC Semantic [client] Retransmit request? Filter duplicate requests? [server] Re-execute function OR retransmit reply? Example RPC
at-least once yes no re-execute because we need the op to happen at least once, and can also retransmit but re-exec is more strict so we highlight that :) Sun RPC
at-most once yes yes re-transmit because we don’t want to re-execute anything that would violate at most once, but this means we need state to keep track of whether the function was executed or not and the result of the execution Java RMI (re-transmits on timeout)
maybe (best-effort) no N/A N/A CORBA (common object request brokerage architecture)

Idempotent operations can be executed multiple times without any side effect, these are OK to run with at-least once semantics (ex: x = 1)

RPC Components

Programmer only writes code for caller() and callee() functions, everything else is autogenerated

image.png


🪖 Marshaling

Marshaling converts caller() arguments → CDR

Unmarshaling converts CDR → callee() arguments


🤑 Transactions

Transactions are a series of operations, where each operation is an RPC to the server. The entire transaction can either be COMMIT or ABORT at the end.

ACID