Remote Procedure Call (RPC) protokoll hajutatud süsteemis
⚡ Nutikas kokkuvõte
Remote Procedure Call (RPC) is an interprocess communication protocol that lets a program execute a procedure in another address space or machine, hiding network details behind an ordinary local function call in distributed client-server systems.

Mis on RPC?
Remote Procedure Call (RPC) on protsessidevaheline suhtlus technique used for client-server applications. The full form of RPC is Remote Procedure Call. RPC mechanisms are used when a computer program causes a procedure or subroutine to execute in a different address space, coded as a normal procedure call without the programmer explicitly coding the details for the remote interaction.
This procedure call also manages low-level transport protocols, such as UDP and TCP/IP, to carry the message data between programs.
RPC tüübid
RPC-d on kolme tüüpi:
- Tagasihelistamise RPC
- Saate RPC
- Partiirežiimis RPC
Tagasihelistamise RPC
This type of RPC enables a peer-to-peer (P2P) paradigm between participating processes. It helps a process to act as both a client and a server.
Tagasihelistamise RPC funktsioonid:
- Handles remotely processed, interactive application problems.
- Provides the server with the client’s handle.
- Callback makes the client process wait.
- Manages callback deadlocks.
- It facilitates a peer-to-peer paradigm among participating processes.
Saate RPC
Broadcast RPC is a client’s request that is broadcast on the network and processed by all servers that have the method for processing that request.
Broadcast RPC funktsioonid:
- Allows you to specify that the client’s request message has to be broadcast.
- Saate deklareerida edastuspordid.
- It helps to reduce the load on the physical network.
Partiirežiimis RPC
Batch-mode RPC helps to queue separate RPC requests in a transmission buffer on the client side, and then send them over a network in one batch to the server.
Functions of Batch-mode RPC:
- It minimizes the overhead involved in sending a request, as it sends requests over the network in one batch to the server.
- This type of RPC protocol is only efficient for applications that need lower call rates.
- See vajab usaldusväärset edastusprotokolli.
RPC Architektuur
RPC arhitektuuril on peamiselt viis programmi komponenti:
- klient
- Klient Stub
- RPC käitusaeg
- Server Stub
- server
RPC Architektuur
Kuidas RPC töötab?
The following steps take place during the RPC process:
Step 1) The client, the client stub, and one instance of the RPC runtime execute on the client machine.
Step 2) The client starts a client stub process by passing parameters in the usual way. The client stub is stored within the client’s own address space. It also asks the local RPC Runtime to send the request to the server stub.
Step 3) In this stage, the user accesses RPC by making a regular local procedure call. The RPC Runtime manages the transmission of messages between the client and server across the network. It also performs the job of retransmission, acknowledgment, routing, and encryption.
Step 4) After completing the server procedure, execution returns to the server stub, which packs (marshals) the return values into a message. The server stub then sends the message back to the transport layer.
Step 5) In this step, the transport layer sends the result message back to the client transport layer, which returns the message to the client stub.
Step 6) In this stage, the client stub demarshals (unpacks) the return parameters in the resulting packet, and execution returns to the caller.
RPC omadused
Siin on RPC põhiomadused:
- The called procedure is in another process, which is likely to reside on another machine.
- Protsessid ei jaga aadressiruumi.
- Parameetrid edastatakse ainult väärtuste järgi.
- RPC käivitub serveriprotsessi keskkonnas.
- It does not offer access to the calling procedure’s environment.
RPC omadused
Siin on RPC olulised funktsioonid:
- Simple call syntax.
- Offers known semantics.
- Provides a well-defined interface.
- It can communicate between processes on the same or different machines.
RPC eelised
Here are the pros/benefits of RPC:
- RPC helps clients communicate with servers through the conventional use of procedure calls in high-level languages.
- RPC is modeled on the local procedure call, but the called procedure is most likely executed in a different process and usually on a different computer.
- RPC supports process-oriented and thread-oriented models.
- RPC makes the internal message-passing mechanism hidden from the user.
- See kohustab jõudlust parandama paljud protokollikihid.
- RPC annab kõhulihastele lihaspingeidtraction; for example, the message-passing nature of network communication remains hidden from the user.
- RPC can be used in both distributed and local environments.
- The effort needed to re-write and re-develop the code is minimal.
RPC miinused
Siin on RPC kasutamise miinused/miinused:
- Remote Procedure Call passes parameters by values only; pointer (reference) values are not allowed.
- Remote procedure call (and return) time — the overhead — is significantly higher than for a local procedure.
- This mechanism is highly vulnerable to failure, as it involves a communication system, another machine, and another process.
- The RPC concept can be implemented in different ways, so there is no single standard.
- It does not offer flexibility for hardware architecture, as it is mostly interaction-based.
- The cost of the process increases because of the remote procedure call.

