liveBook · Manning

Remote procedure call

As explained in Akka in Action, Second Edition

A remote procedure call is a communication mechanism that invokes an operation in another process or system as though it were a local procedure.

A remote procedure call (RPC) invokes an operation in another process or system as though it were local. That familiar model can conceal network and blocking behavior: database calls are essentially RPCs, and standard drivers such as JDBC commonly use blocking I/O. section 1.4.1

In a scaling chat application, combining threads, locks, database access, and RPC-based network services can make behavior and failures difficult to isolate. Synchronous RPC and blocking I/O contrast with an actor approach based on asynchronous messaging and nonblocking I/O. section 1.3 section 1.4.1

Akka gRPC provides an RPC-oriented way to expose ports for an ActorSystem:

  • Define the intended interface in a .proto file; generated classes provide the required implementation pieces. section 11.2
  • Use Protocol Buffers together with classic RPC, with HTTP/2 available for communication. section 11.2
  • Create server and client ports; the server side establishes the starting point, while client treatment is deferred. section 11.2
Table 1.1 Differences between the traditional approach and the Akka approach (view table figure)

Objective

Traditional method

Akka method

Scaling

Uses a mix of threads, shared mutable state in a database (create, insert, update, delete), and web service RPC calls

Actors send and receive messages. No shared mutable state. Log of immutable events.

Providing interactive information

Polls for current information

Event-driven: pushes when the event occurs

Scaling out on the network

Synchronous RPC, blocking I/O

Asynchronous messaging, nonblocking I/O

Handling failures

Handles all exceptions; continues only if everything works

Lets the application crash. Isolates the failure, and continues without the failing parts.

Compare RPC-based scaling with actor messaging across shared state, interactivity, network I/O, and failure handling. section 1.3

How Akka in Action, Second Edition covers it

How deep it goes
Explains blocking database RPCs and introduces Akka gRPC interfaces, while deferring client-side treatment.
Examples
Uses a scaling business chat application, DAO database calls, and a traditional-versus-actor comparison table.
What it assumes
Starts from gRPC basics before describing Protocol Buffers and classic RPC; no prior background is specified.
What you can do after
Apply it via Akka gRPC to create a server-side port after defining a .proto interface.
How it connects
Connects RPC with threads, locks, JDBC, blocking I/O, ActorSystem, Protocol Buffers, HTTP/2, and asynchronous messaging.

Also explained in

Compare how 5 books explain remote procedure call →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.