How a simple RPC framework is tempered (I)--openings

Source: Internet
Author: User

Prologue, this is a series of articles about the concept of RPC, mainly through a step-by-step adjustment, refining a relatively complete RPC framework.

RPC (remote Procedure call Protocol)--remoting procedure calls protocol, based on the C/S model. There is an article on the network is well written, you can go to understand the relevant concepts in layman RPC

Here, just use one of the authors above



In summary, there are 4 pieces of core content.

  1. Transfer of RPC data . As above the Rpcconnector,rpcchannel. They are mainly responsible for data transmission, the specific client-server connection is not a socket connection, is the original TCP connection or use HTTP, these RPC protocol itself does not make any provision. then our task is to abstract out such a transport layer.
  2. RPC messages. such as the RpcProtocol above, as well as the Encode,decode method. Because RPC is a remote call, there is no way to directly function calls, so a special set of protocols must be used to represent the invocation and the result of the call. In addition, because the actual application is basically a cross-machine connection, it is not possible to pass the memory variables directly, that is, you also need to encode the message into a string such as a type of content that can be transmitted across devices. There are many encapsulation protocols for specific RPC messages, and the common ones are based on Xml,json encapsulation. then our task is to abstract out such a protocol layer.
  3. RPC Service registration. as above callee-->export. What calls are specifically supported by the server, and after receiving RPC requests from the client, how to invoke the actual method that needs to be executed, which is also a complete RPC framework that must be considered. Some of the slightly higher-level frameworks are self-registering, and now the mainstream RPC framework supports the definition of remote interfaces via IDL (Interface definition Language) for cross-language RPC. then our task is to abstract out an RPC service registration mechanism .
  4. RPC Message processing . As above the Rpcinvoker. This is in fact not related to RPC itself, generally is to consider supporting asynchronous/synchronous calls . This part, probably I will also do some clarification, but not the focus of this series.
The RPC framework, farmers will use Python as a development language, why, and a little embarrassed: less code, easy to explain (lazy is the nature of the Code workers). The initial idea is that the entire framework starts with the original normal call, then evolves step by step, and finally generates a complete RPC framework. In this process, I hope to bring you more profound knowledge of RPC primer and Code modification. Said a bit high, hehe.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

How a simple RPC framework is tempered (I)--openings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.