Remote Procedure Calls (RPC)

Remote Procedure Calls (RPC)

In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (local) procedure call, without the programmer explicitly coding the details for the remote interaction.

That is, the programmer writes essentially the same code whether the subroutine is local to the executing program, or remote. This is a form of client–server interaction (caller is client, executor is server), typically implemented via a request–response message-passing system.

In the object-oriented programming paradigm, RPCs are represented by remote method invocation (RMI). The RPC model implies a level of location transparency, namely that calling procedures are largely the same whether they are local or remote, but usually, they are not identical, so local calls can be distinguished from remote calls.?

The sequence of events in a remote procedure call are given as follows ?

  • The client stub is called by the client.
  • The client stub makes a system call to send the message to the server and puts the parameters in the message.
  • The message is sent from the client to the server by the client’s operating system.
  • The message is passed to the server stub by the server operating system.
  • The parameters are removed from the message by the server stub.
  • Then, the server procedure is called by the server stub.

There are four types of RPCs

Unary RPCs where the client sends a single request to the server and gets a single response back, just like a normal function call.

Server streaming RPCs where the client sends a request to the server and gets a stream to read a sequence of messages back. The client reads from the returned stream until there are no more messages.

Client streaming RPCs where the client writes a sequence of messages and sends them to the server, again using a provided stream. Once the client has finished writing the messages, it waits for the server to read them and return its response.

Bidirectional streaming RPCs where both sides send a sequence of messages using a read-write stream. The two streams operate independently, so clients and servers can read and write in whatever order they like: for example, the server could wait to receive all the client messages before writing its responses, or it could alternately read a message then write a message, or some other combination of reads and writes. The order of messages in each stream is preserved.

Advantages of Remote Procedure Call

  • Remote procedure calls support process oriented and thread oriented models.
  • The internal message passing mechanism of RPC is hidden from the user.
  • The effort to re-write and re-develop the code is minimum in remote procedure calls.
  • Remote procedure calls can be used in distributed environment as well as the local environment.
  • Many of the protocol layers are omitted by RPC to improve performance.

Disadvantages of Remote Procedure Call

  • There is no flexibility in RPC for hardware architecture. It is only interaction based.
  • There is an increase in costs because of remote procedure call.

I hope you found the article useful.

Happy Coding :)


要查看或添加评论,请登录

Umang Agarwal的更多文章

  • Push and Pull Configuration Management Tools

    Push and Pull Configuration Management Tools

    Push and pull configuration management tools are software solutions that facilitate the management and distribution of…

    10 条评论
  • What is Configuration Management in DevOps?

    What is Configuration Management in DevOps?

    Configuration management in DevOps refers to the process of managing and controlling the configuration of software…

    3 条评论
  • Principles of Web Distributed Systems Design

    Principles of Web Distributed Systems Design

    Like most things in life, taking the time to plan ahead when building a web service can help in the long run;…

  • What is non-monotonicity good for?

    What is non-monotonicity good for?

    The difference between monotonicity and non-monotonicity is interesting. For example, adding two numbers is monotonic…

  • Lamport Clocks

    Lamport Clocks

    Assuming that we cannot achieve accurate clock synchronization - or starting with the goal that our system should not…

  • Does time progress at the same rate everywhere?

    Does time progress at the same rate everywhere?

    We all have an intuitive concept of time based on our own experience as individuals. Unfortunately, that intuitive…

  • Two Phase Commit (2PC)

    Two Phase Commit (2PC)

    Two phase commit (2PC) is a protocol used in many classic relational databases. For example, MySQL Cluster (not to be…

  • Partition and Replication

    Partition and Replication

    The manner in which a data set is distributed between multiple nodes is very important. In order for any computation to…

  • Forward Proxy vs Reverse Proxy Servers

    Forward Proxy vs Reverse Proxy Servers

    Forward Proxy A forward proxy is an intermediary that sits between one or more user devices and the internet. Instead…

  • Types of NoSQL databases

    Types of NoSQL databases

    NoSQL is a collection of data items represented in a key-value store, document store, wide column store, or a graph…

社区洞察

其他会员也浏览了