RPC和RMI的区别(Difference Between RPC and RMI)

时间:2023-03-08 22:54:08
RPC和RMI的区别(Difference Between RPC and RMI)

RPC和RMI的区别(Difference Between RPC and RMI)

RPC vs RMI

  RPC (Remote Procedure Call) and RMI (Remote Method Invocation) are two mechanisms that allow the user to invoke or call processes that will run on a different computer from the one the user is using. The main difference between the two is the approach or paradigm used. RMI uses an object oriented paradigm where the user needs to know the object and the method of the object he needs to invoke. In comparison, RPC isn’t object oriented and doesn’t deal with objects. Rather, it calls specific subroutines that are already established.

  RPC(远程过程调用)和RMI(远程方法调用)是两种可以让用户从一台电脑调用不同电脑上面的方法的的机制(也可以称作规范、协议)。两者的主要不同是他们的使用方式或者称作范式,RMI使用面向对象的范式,也就是用户需要知道他调用的对象和对象中的方法;RPC不是面向对象也不能处理对象,而是调用具体的子程序。

  RPC is a relatively old protocol that is based on the C language, thus inheriting its paradigm. With RPC, you get a procedure call that looks pretty much like a local call. RPC handles the complexities involved with passing the call from the local to the remote computer. RMI does the very same thing; handling the complexities of passing along the invocation from the local to the remote computer. But instead of passing a procedural call, RMI passes a reference to the object and the method that is being called. RMI was developed by Java and uses its virtual machine. Its use is therefore exclusive to Java applications for calling methods on remote computers.

  RPC是一个基于C语言的相对较旧的协议,因此也就继承了C语言的范式,使用RPC,你可以像调用一个本地方法一样调用远程的方法,由RPC处理调用过程的复杂操作,RMI的功能和RPC基本一样。但是和RPC只传输一个过程调用不同,RMI需要传输对象的引用以及调用的方法。RMI是用Java开发的,运行在Java虚拟机上,因此它的用途是调用远程计算机上的java应用程序。

  In the end, RPC and RMI are just two means of achieving the same exact thing. It all comes down to what language you are using and which paradigm you are used to. Using the object oriented RMI is the better approach between the two, especially with larger programs as it provides a cleaner code that is easier to track down once something goes wrong. Use of RPC is still widely accepted, especially when any of the alternative remote procedural protocols are not an option.

  最后,RPC和RMI只是处理同一个问题的不同方式,这一切都归结于你所使用的语言和你所使用的范式。使用面向对象的RMI是两者之间的更好的方法,特别是大型程序,使用RMI代码更简洁,更容易追踪bug。RPC目前依然是被广泛接受的,尤其是当无法选择任何的可替代的远程程序协议时候。

Summary:

1.RMI is object oriented while RPC isn’t2.RPC is C bases while RMI is Java only3.RMI invokes methods while RPC invokes functions4.RPC is antiquated while RMI is the future

总结:

1、RMI是面向对象的,而RPC不是

2、RPC是基于C语言的,而RMI是仅仅基于Java的

3、RMI调用方法,而RPC调用函数

4、RPC是过时的,而RMI是未来

原文地址: Difference Between RPC and RMI | Difference Between | RPC vs RMI http://www.differencebetween.net/technology/protocols-formats/difference-between-rpc-and-rmi/#ixzz47OPXuhEv