RPC Remote Procedure Call Detailed


RPC (remote procedure call)
distributed system, service calls between each other easier, like calling a local service the same. (No sense of long-distance calls)

implement functions and modules RPC model are many, as long as the remote call through to the model , can call for the RPC

Python in the RPC model package has gRPC, xmlrpc, etc.
However, it is clear that, just to achieve a thinking RPC remote call a model many modules will be built using the RPC model thinking .

 


calls for steps RPC:
send the other end of the service
user calling == >> client-stub packing the parameters == >> RPCRun send ... RPCRun accepted == >> Server-stub unpack == >> Server call, processing result.

accepts the reverse order: client
Server result obtained, transmission == >> ServerStub packaged return value == >> RPCRun transmitted ... RPCRun receiving unpacked == == >> ClientStub >> transmitted to the User

 



 


the RCP module work:

in addition to the middle part of the RPC, and other local calls essentially the same: to call, and returns the result.
packaged in the RPC service call part of the work content:
at the time of the call to other servers need to
package the relevant parameters, and then sent via RPC Request and waiting for returns.
Other services RPC request is received, unpack run the Package return.


Each service have to do is accept the request RPC packet analysis solution, and then call the service returns the results, and returns the contents of the former is still packed.


Packaging Solutions package:

In the process, in addition to the corresponding essential part of this service, packing and unpacking also accounted for very heavy.

What protocol to use to communicate general matter, the necessary encryption and decryption, as well as check verification data are very important.
RPC the writing should pay attention to efficient low-latency, data confidentiality, etc.

in the need for efficient low extension of the RPC, rarely go using http communication protocol, http protocol header heavy, relatively speaking binary communications need to pass a lot of information bloated.

more time is spent serialization and de-serialization of content to achieve


expansion:

-----
the difference difference RESTful and RPC and RMI-
RPC is done remotely invoke methods of process
RESTful style is named url .

If you write a module API RPC's url address should be:
? queryGoods goods_id = 1

RPC interface used when writing is more biased in favor of the query process:
? 1 = Goods goods_id

RESTful resource is a resource additions and deletions to change search.

two those reflected in the style is completely different, obviously, RESTful style interfaces have better readability on the front butt and reading.

-----
RPC and RMI (remote Method, Ivocation)
RMI is a remote party Call.
Only Java inside before use, can be understood as java language RPC.
Java virtual machine jvm implement interprocess communication protocol that is used by RMI.
RMI Each method has a signature, RMI clients and servers by The method signature for remote method invocation,

-----
performance RPC framework:
    Dubbo


-----
RPC and Celery
the Python commonly used in asynchronous processing, the message queue in principle, similar to the RPC.
Require passing function parameters and names response.


 

Guess you like

Origin www.cnblogs.com/jrri/p/11863749.html