What is rpc and application scenarios?

Your programming before, right? There you program a function or method calls between right?

For example, you write two functions fa and fb, fb certainly can be called in fa where this can be understood, right? Well, bedding finished. Next into the topic: someone wrote a program, the program has had a function rf, and this program is run independently. Want to call this rf, how do you write your own program? rpc is the technology in order to solve this problem arise. Remote Procedure Call is a kind of function calls to establish a mechanism within a single program function calls between two otherwise similar between independent processes. Thus, not only function within a program can call each other, functions among different programs can call each other. As for applications, you can start to think from within the program uses function calls. First, it can directly use some of the features of other programs, which is the most basic. More importantly, the system can be achieved using the rpc distributed architecture, on the one hand some features compare associated should be put together to achieve, one reason physical factors required to achieve multi-machine system is decomposed into, so some functions on a machine in order to achieve process, and additional functionality is implemented as a process on another machine, collaboration and information exchange between these two processes can be achieved by rpc. In addition, some ready-made system designed by rpc expansion mode is to achieve, then you need to extend the functionality of the original system by rpc protocol programmatically it chooses

 

Upstairs was right, I give an example. You operate your own files on your computer hard drive, a file on a method, and access to the network, no difference in the use, but there are differences in the actual implementation. Generally the difference you can certainly understand. There are at least a variety of network protocols it. rpc is something like that. Anyway, data is synergy between different computing body. Calls between nothing more than traditional programming, functions and function, collaborative data is easy, basic in your code design, to take into account the design and call data space, not even the concept, only the concept of local variables and global variables . The synergies between cross-process running, the more the problem of data collaboration. There are also synchronous asynchronous, synchronous, but there is always a point

 

The RPC, is then passed to serialize the data received by the server, and acquires the return value of a sequence.

In network communications, whether the UDP or TCP, we have to design their own application layer protocol at the transport layer, so that the data content may communicate with each other can recognize a transmission of the front and rear ends.

Later, people expect it to make it easier to interact with the front and rear end, therefore, put forward RPC, like calling a function to allow the front and rear ends to communicate, shield the complex application-layer protocol.

Guess you like

Origin www.cnblogs.com/Rivend/p/12078996.html