Understanding RPC: Principles, Architecture, and Common Frameworks

This article explains why RPC is essential for distributed services, defines its core concepts and architecture, compares it with REST, SOAP and SOA, outlines the components and call flow, and reviews key technologies and popular Java‑based RPC frameworks such as Dubbo, Thrift and Avro.

Architect's Tech Stack
Architect's Tech Stack
Architect's Tech Stack
Understanding RPC: Principles, Architecture, and Common Frameworks

1. Why RPC Is Needed

As web applications grow, monolithic architectures become insufficient, leading to vertical, then distributed service architectures; RPC provides a unified way to invoke services across machines, reducing duplicated serialization, networking, and connection‑handling code.

2. What Is RPC

Remote Procedure Call (RPC) allows a program to call a function on a remote server as if it were a local call, abstracting network protocols, serialization, service description, and performance concerns.

3. RPC Architecture Components

A typical RPC system includes four parts: the client (service consumer), client stub (packages request), server stub (unpacks request and invokes the local service), and the server (service provider).

4. RPC Call Process

1) The client invokes a local proxy method. 2) The client stub serializes the method name and arguments into a network message. 3) The message is sent over TCP (or a persistent connection). 4) The server stub receives, deserializes, and calls the actual service. 5) The result is serialized and returned to the client stub. 6) The client stub deserializes the response and delivers it to the caller.

5. Differences Between RPC, REST, SOAP, and SOA

REST is HTTP‑centric, JSON‑based, simple but less secure; SOAP is XML‑based, heavyweight with WS‑Security; SOA is a coarse‑grained, loosely‑coupled service architecture; RPC focuses on binary protocols and high performance for internal service calls.

6. Problems RPC Frameworks Must Solve

Define communication protocols between client and server.

Provide efficient network transport.

Expose services for discovery.

Enable service discovery for clients.

Handle fast serialization/deserialization.

7. Foundations of RPC Implementation

High‑performance network library (e.g., Netty).

Efficient serialization (e.g., Protobuf, Kryo, FastJson).

Reliable service registry (e.g., Zookeeper, Consul, Etcd).

Session/state management for stateful calls.

8. Key Technologies Used by RPC

Dynamic proxies (JDK, CGLib, Javassist) to generate client and server stubs.

Serialization/Deserialization to convert objects to byte streams.

Java NIO (or Netty/MINA) for asynchronous, high‑concurrency I/O.

Service registration and discovery centers (Zookeeper, Redis, etc.).

9. Popular RPC Frameworks

RMI – Java native remote method invocation.

Hessian – Lightweight HTTP‑based remoting.

protobuf‑rpc‑pro – Netty‑based RPC using Google Protobuf.

Thrift – Cross‑language framework with code generation.

Avro – Hadoop‑originated data exchange protocol.

Dubbo – Alibaba’s high‑performance Java RPC framework integrated with Spring.

10. Visual Diagrams

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Distributed Systemsbackend-developmentRPCserializationService Architecture
Architect's Tech Stack
Written by

Architect's Tech Stack

Java backend, microservices, distributed systems, containerized programming, and more.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.