[Reprint] Popular language explain what is the RPC framework

Source: Internet
Author: User

From know: https://www.zhihu.com/question/25536695

about RPC
Your topic is RPC framework, first understand what is called RPC, why RPC,RPC refers to a remote procedure call, that is, two server A, a, an application deployed on a server, want to invoke the application provided on the B server function/method, because not a memory space, cannot be directly called, The semantics of the call and the data that communicates the call need to be expressed over the network.


For example, a method might be defined like this:
Employee getemployeebyname (String fullName)
So:
    • First of all, to solve the problem of communication, mainly by establishing a TCP connection between the client and the server, all the exchanged data of the remote procedure call is transmitted in this connection. The connection can be on-demand, disconnected after the call ends, or a long connection, and multiple remote procedure calls share the same connection.
    • Second, to solve the problem of addressing, that is, how the application on a server tells the underlying RPC framework, how to connect to a B server (such as a host or IP address), and a specific port, the name of the method is what, in order to complete the call. For example, RPC based on the Web service protocol stack, it is necessary to provide a endpoint URI, or to find it from a UDDI service. In the case of RMI invocation, an RMI registry is also required to register the address of the service.
    • Thirdly, when an application on a server initiates a remote procedure call, the parameters of the method need to be passed to the B server through the underlying network protocol such as TCP, because the network protocol is binary based, the values of the parameters in memory are serialized into binary form, That is, serialization (Serialize) or marshalling (marshal), which sends the serialized binary to the B server by addressing and transmitting.
    • Finally, when the server receives the request, it needs to deserialize the parameter (the inverse of the serialization), revert to the in-memory representation, and then find the corresponding method (part of the address) to make a local call, and then get the return value.
    • The return value is also sent back to the application on Server A, also to be serialized, Server A received, then deserialized, revert to in-memory expression, to a server on the application
Why RPC? is a requirement that cannot be done within a process, or even within a computer, by local invocation, such as communication between different systems, or even between different organizations. Because computing power requires scale-out, applications need to be deployed on clusters of multiple machines,

RPC has many protocols, such as the RPC style of the earliest Corba,java rmi,web service, Hessian,thrift, and even the rest API.

[Reprint] Popular language explain what is the RPC framework

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.