Why RPC Beats HTTP for Enterprise Services: OSI Layers, Architecture & Top Frameworks
This article explains the OSI seven‑layer model, compares RPC and HTTP services, details RPC architecture, synchronous vs asynchronous calls, and reviews popular RPC frameworks, helping developers choose the right approach for enterprise applications.
OSI Network Seven-Layer Model
Before discussing RPC vs HTTP, it's useful to understand the OSI seven‑layer model (often simplified to five layers). The layers from top to bottom are:
Application layer – defines interfaces for communication and data transfer.
Presentation layer – defines data format, encoding and decoding.
Session layer – manages user sessions and logical connections.
Transport layer – handles end‑to‑end data transmission.
Network layer – defines how data is transferred between network devices.
Data link layer – encapsulates network‑layer packets into frames for physical transmission.
Physical layer – transmits binary data over the medium.
In practice, the presentation and session layers are often merged with the application layer, so the focus is on the application and transport layers: HTTP operates at the application layer, TCP at the transport layer. Understanding this helps see why RPC can be more efficient than HTTP.
RPC Services
RPC is introduced from three perspectives: architecture, synchronous vs asynchronous calls, and popular frameworks.
RPC Architecture
A typical RPC architecture includes four core components: Client, Server, Client Stub, and Server Stub.
Client – the caller of the service.
Server – the provider of the service.
Client Stub – stores the server address, packages request parameters into a network message, and sends it.
Server Stub – receives the message, unpacks it, and invokes the local method.
RPC is commonly used in large enterprises where many systems and complex business lines require high efficiency. In Java projects, interfaces are defined, packaged into a JAR, and shared between client and server to reduce client JAR size and improve decoupling.
Synchronous vs Asynchronous Calls
Synchronous calls block the client until the result returns; asynchronous calls return immediately, with results delivered via callbacks, similar to Java's Callable/Future versus Runnable.
Popular RPC Frameworks
Three widely used open‑source RPC frameworks are highlighted:
gRPC – Google’s framework based on HTTP/2, supports many languages, built on Netty.
Thrift – Facebook’s cross‑language service framework with an IDL code generator.
Dubbo – Alibaba’s framework with pluggable protocols and serialization, integrates with Spring.
HTTP Services
Traditional enterprise development often uses HTTP/RESTful APIs, which are simple and convenient for small projects with few interfaces. Example request: POST http://www.httpexample.com/restful/buyer/info/share.
For large enterprises with many subsystems, RPC offers advantages such as persistent connections, reduced handshake overhead, built‑in service registry, monitoring, and dynamic scaling, making it more suitable than HTTP for high‑performance needs.
Conclusion
RPC services are typically chosen for large enterprises due to higher efficiency, while HTTP services suit smaller projects with faster iteration. The choice should be based on a thorough evaluation of project requirements rather than simply following market trends.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Su San Talks Tech
Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.
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.
