# Remote Procedure Call

**In short:** Remote Procedure Call lets one application run a procedure in another application across a network. It looks like a local call but behaves differently: it is slower, can fail, and needs careful interface design.

## Explanation

Remote Procedure Call (RPC) is an integration style. Each application makes some of its procedures available so that other applications can start them over the network. Hohpe and Woolf call this style Remote Procedure Invocation. The article Integration Styles compares it with other styles.

**Data stays behind an interface.** Each application is built as a component. Its data sits behind an interface, and other applications reach it only through the procedures on offer. This lets the owning application protect the integrity of its data.

**The call blocks.** By default, the caller waits until the server finishes its work. Only then does the caller continue. The article Synchronous vs. Asynchronous Communication covers this in more depth.

**A remote call is not a local call.** Many RPC tools make a remote call look like a local one. That is deceptive. The two work quite differently, and the difference affects how well the integration works. Remote calls are usually much slower than local calls. They are also less reliable, and network problems can make them fail.

**Granularity matters.** If you simply turn in-process method calls into remote calls, you get chatty communication: many small calls. This performs poorly. Remote interfaces therefore need to be coarser-grained, so each call does more work.

**Change is harder across a boundary.** Refactoring (see the article Refactoring) is much harder when components are remote services than when they are in-process libraries. This makes it harder to evolve interfaces over time.

**Implementations.** CORBA provides RPC through an intermediate layer called the object request broker. Java RMI is another implementation. SOAP succeeds XML-RPC and encodes its HTTP-based calls in XML. gRPC is a modern framework: you define a service and its methods, and clients call them remotely as if they were local.

## Example

An order application needs a customer's credit status. The credit application exposes a procedure called "check credit". The order application calls it and waits for the answer before it accepts the order. If the network is down, the call fails and the order application must decide what to do. If the order application instead made separate calls for the customer's name, limit, and balance, it would be chatty. A single "get credit summary" call would suit a remote interface better.

## Trade-offs

RPC keeps each application's data behind an interface, which protects data integrity. The cost is that remote calls are slower and less reliable than local ones, and they can fail because of the network. The call-like look hides these differences. Interfaces must be coarser-grained to avoid chatty traffic. Changing interfaces later is harder across remote boundaries than inside one program.

A blocking remote procedure call: the caller waits until the server returns.

```mermaid
sequenceDiagram
  participant C as Caller application
  participant S as Server application
  C->>S: Call procedure (data)
  Note over C: Caller blocks and waits
  S-->>C: Result (control returns)
```

## Checks

- The document states how callers handle remote call failures caused by network problems.
- Remote interfaces are coarse-grained rather than a direct copy of in-process method calls.
- Each application's data is reachable only through its exposed procedures.
- The document records that callers block while waiting for the server.

## Related

- [Integration Styles](https://arc.fuet.ch/concepts/integration/integration-styles-overview.md)
- [Synchronous vs. Asynchronous Communication](https://arc.fuet.ch/concepts/integration/synchronous-vs-asynchronous-communication.md)
- [Messaging](https://arc.fuet.ch/concepts/integration/messaging.md)
- [File Transfer](https://arc.fuet.ch/concepts/integration/file-transfer.md)
- [Shared Database](https://arc.fuet.ch/concepts/integration/shared-database.md)
- [Request-Reply](https://arc.fuet.ch/concepts/integration/request-reply.md)
- [Refactoring](https://arc.fuet.ch/concepts/fundamentals/refactoring.md)
- [Information Hiding](https://arc.fuet.ch/concepts/principles/information-hiding.md)

## Sources

- [Introduction to Integration Styles - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/IntegrationStylesIntro.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Remote procedure call - Wikipedia](https://en.wikipedia.org/wiki/Remote_procedure_call) — en.wikipedia.org, accessed 2026-11-09
- [Remote Procedure Invocation - Enterprise Integration Patterns](https://www.enterpriseintegrationpatterns.com/patterns/messaging/EncapsulatedSynchronousIntegration.html) — enterpriseintegrationpatterns.com, accessed 2026-11-09
- [Microservices](https://martinfowler.com/articles/microservices.html) — martinfowler.com, accessed 2026-11-09
- [Introduction to gRPC | gRPC](https://grpc.io/docs/what-is-grpc/introduction/) — grpc.io, accessed 2026-11-09
