← Lessons

quiz vs the machine

Silver1050

Networking

The RPC Concept

Calling a function on another machine as if it were local.

4 min read · intro · beat Silver to climb

A Function Across The Wire

A remote procedure call lets one program invoke a function that runs on another machine. The goal is to make a network call feel like an ordinary local function call.

What The Plumbing Does

The framework hides the network behind generated code.

  • The client stub turns arguments into bytes, a step called marshalling.
  • The bytes travel over the network to the server.
  • The server stub unmarshals the bytes and calls the real function.
  • The result travels back and is returned to the caller.

Why It Is Not Magic

A local call always returns, but a remote call can fail in ways a local one cannot.

  • The network may drop or delay messages.
  • The server may crash after doing the work but before replying.
  • Latency is far higher than a memory access.

Treating remote calls as if they were free or always successful is the classic mistake. Good RPC code plans for timeouts, retries, and partial failure.

Key idea

RPC makes a remote function look like a local one by marshalling arguments across the network, but callers must still handle latency and partial failure that local calls never face.

Check yourself

Answer to earn rating on the learn ladder.

1. What does the client stub do with the arguments?

2. Why is a remote call different from a local one?