Learning and remembering: RPC framework calling process

Learning and remembering: RPC framework calling process

Introduction to RPC

RPC is the abbreviation of Remote Procedure Call. It is a protocol that requests services on a remote computer program through the network without having to understand the underlying network technology. No additional programming is required in the code, just like calling a local method directly.

[[376896]]

RPC Framework Role

There are three important roles in the RPC framework: RPC Server, RPC Client and Registry, as shown in the following figure:

  • RPC Server: Provider, the service provider that exposes the service
  • RPC Client: Consumer, the service consumer that calls the remote service
  • Registry: Service registration and discovery service registry

RPC core components

The RPC architecture consists of five core components: Client, Client Stub, Server, Server Stub, and NetWork Service. Stub can be understood as a stub.

  • Client: The client, the caller of the service
  • Client Stub: Client stub stores the address information of the server and is responsible for assembling the client's request information into a network message and sending it remotely to the service provider through the network.
  • Server: The server, the real service provider
  • Server Stub: The server stub receives messages from the client and decompresses the messages before calling local service methods.
  • NetWork Service: underlying network transmission, which can be TCP or HTTP

RPC call process

The overall calling process of the RPC framework is shown in the following figure:

  1. The client calls the remote interface service by local call;
  2. After receiving the call, the client stub serializes the call information object and assembles it into a binary message body for network transmission;
  3. The client sends messages to the remote server through Sockets;
  4. After receiving the message, the server stub deserializes and decodes the network information object;
  5. The server stub Server Stub calls the local interface service of the server according to the decoding result;
  6. The local interface service is executed and the processing result is returned to the server stub Server Stub;
  7. The server stub serializes the returned result object and assembles it into a message body;
  8. The server then sends the message to the client through Sockets;
  9. After receiving the result message, the client stub serializes and decodes the network information object;
  10. The client obtains the final interface processing result.

The goal of the RPC architecture is to encapsulate steps 2, 3, 4, 7, 8, and 9 so that the caller feels like calling a local method.

Open source RPC framework

  • Dubbo: The earliest open source RPC framework in China, developed by Alibaba and open sourced to the public at the end of 2011, only supports Java language
  • Spring Cloud: Compared with RPC frameworks such as Dubbo, Spring Cloud provides a full set of distributed system solutions
  • gRPC: It is a high-performance, general-purpose open source RPC framework developed by Google that supports multiple languages.

<<:  What is coming will come. Taiwan may shut down 3G this year.

>>:  6 hot trends in IT recruiting, and 5 that are cooling down

Recommend

5G Imagination in the Internet of Vehicles Makes Transportation Smarter

[[351620]] 5G is one of the Internet of Things co...

Record an incident where a network request connection timed out

[[338985]] This article is reprinted from the WeC...

...

Shandong issues six standards for e-government cloud platform construction

Recently, Shandong issued six standards in the fi...

How wireless mesh networking technology can power smart buildings

Smart buildings are becoming increasingly importa...

5G standard draft released: it’s not just the speed that changes

The Mobile World Congress, the most influential a...

Wi-Fi 5 is out! Wi-Fi 6 advantages: faster speed/more power efficient

If 2019 is the first year of Wi-Fi 6 commercializ...