Understanding RPC Architecture: Basic Structure and Technical System
This article explains the fundamental structure of Remote Procedure Call (RPC) architecture, detailing its core components such as providers, consumers, channels, protocols, and processors, and discusses the supporting technical system including network communication, serialization methods, transport protocols, and synchronous versus asynchronous remote invocation strategies.
When building a distributed system, one must consider how services call each other; if existing frameworks like Dubbo or Spring Cloud are unavailable, implementing a custom RPC framework becomes necessary.
RPC Architecture Basic Structure
The architecture consists of providers (servers) and consumers (clients). Communication relies on a RpcChannel and RpcProtocol , while the service entry point is exposed via RpcAcceptor and requests are sent through RpcConnector . A unified contract called Remote API defines the interface.
Key components include:
Client side: RpcClient , RpcProxy , RpcCaller , RpcConnector
Server side: RpcServer , RpcInvoker , RpcProcessor , RpcAcceptor
Shared: RpcProtocol , RpcChannel
Technical System of RPC Architecture
Network Communication
Performance favors long-lived TCP connections and non‑blocking I/O (NIO) with multiplexing, while reliability requires link health checks and reconnection logic.
Serialization
Data is serialized for transmission; common choices are text‑based (XML, JSON) and binary (Protocol Buffers, Thrift). Selection should consider space, time, and CPU/memory overhead.
Transport Protocol
RPC can operate over various OSI layers; TCP serves at the transport layer, while custom protocols (e.g., Dubbo) may be built atop it to reduce overhead and increase extensibility.
Remote Invocation
Calls can be synchronous (blocking) or asynchronous using Java Future (Future‑Get or Future‑Listener). Asynchronous patterns improve throughput, while synchronous calls simplify development.
Summary
RPC is a foundational technology for service‑to‑service interaction in distributed systems; understanding its basic structure and technical stack—network communication, serialization, transport protocols, and invocation models—helps developers design and implement effective remote call mechanisms.
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.