Skip to content
IT glossary
BackendUpdated December 3, 2026

RPC

A remote procedure call lets a program ask another process or service to run a function and return the result. It may look like an ordinary function call in code, but the request and response travel as messages.

Also known as: удалённый вызов процедур

What RPC means

A remote procedure call (RPC) lets a client invoke an operation such as GetOrder or ReserveStock without running that operation itself. The client supplies the inputs; the server runs the code and sends back the result. “Remote” means the operation runs in another process. That process can be on the same machine, though backend services often communicate over a network.

What happens behind the call

Say your code calls orders.GetOrder(42). In a typical RPC framework, orders is a client stub: an object that exposes the server's methods as callable functions. The stub and its library serialize the arguments into a message, identify the method to invoke, and send the request. On the other side, the server library decodes the message and dispatches it to the handler for GetOrder. The handler runs, and the server sends back a result or an error status. Many frameworks generate stubs from a contract that defines the methods and their request and response types.

RPC describes this style of interaction, not a single protocol. For example, gRPC typically uses Protocol Buffers to define and encode messages and HTTP/2 to carry them. JSON-RPC defines a JSON message format without requiring one particular transport.

Example: the server succeeds, but the client times out

A checkout service might ask an inventory service to reserve two units. In pseudocode:

inventory.ReserveStock(sku="A42", quantity=2, requestId="r-781")
→ reservationId="res-204"

Now suppose inventory creates the reservation but the response never reaches checkout. Checkout sees a timeout, not proof that the operation failed. Blindly retrying could reserve four units instead of two. One solution is to treat requestId as an idempotency key: checkout reuses the key on retry, and inventory makes sure the same key does not create a second reservation. Adding a request ID alone does not provide that guarantee; the server has to enforce it.

When to use RPC

RPC is common in internal service APIs when one service needs another to perform a named operation and report the outcome. RPC APIs are usually organized around methods such as GetOrder; REST APIs are organized around resources and operations on them, such as GET /orders/42. Both can use HTTP, so the transport alone doesn't tell you which style an API follows. A message queue is often a better fit when the caller can submit work and move on without an immediate result.

What interviewers look for

If asked how RPC differs from a local call, don't stop at “it goes over the network.” Explain what the caller can and cannot know after a failure: a timeout limits how long it waits, but it doesn't necessarily stop the server or undo its work. Set deadlines that fit the caller's latency budget, and retry only when another attempt won't produce an unwanted duplicate effect.