简体   繁体   English

在同一JVM中的远程EJB调用与本地EJB调用性能

[英]Remote EJB call vs Local EJB call performance in same JVM

I was trying to find out if there is any difference when I am calling a service through its local interface / remote interface in performance within the same JVM. 我试图找出通过本地接口/远程接口调用服务时,在同一JVM中的性能是否存在任何差异。

Based on this article: http://www.onjava.com/pub/a/onjava/2004/11/03/localremote.html?page=last&x-showcontent=text Local call should be a bit faster especially in cases for Collection of Objects. 基于本文: http : //www.onjava.com/pub/a/onjava/2004/11/03/localremote.html? page = last&x-showcontent= text本地调用应该更快一些,尤其是在进行Collection的情况下对象。

Based on my testing I could not find a big difference between the two however maybe I was trying it with small amount of data. 根据我的测试,我发现两者之间没有太大区别,但是也许我尝试使用少量数据进行尝试。

But anyway I would like to know if it has any downfall to call a service through its remote interface when we are in the same JVM because in my project we are generating both local/remote interfaces however there are no real remote calls, the client and the service is within the same JVM and I am thinking about cleaning up the mess and removing the unnecessary generated remote views because people started to use both without reason. 但是无论如何,我想知道当我们在同一个JVM中时通过它的远程接口调用服务是否有任何失败,因为在我的项目中,我们正在生成本地/远程接口,但是没有真正的远程调用,客户端和该服务位于同一JVM中,我正在考虑清理混乱并删除不必要的生成的远程视图,因为人们开始无故使用这两种视图。

Thanks! 谢谢!

  • implementation will vary between containers how remote interfaces perform, you cannot rely on it performing similar to local interfaces (though most containers will realize you're actually accessing a 'local' remote interface). 不同容器在远程接口的执行方式上的实现方式会有所不同,您不能依靠它来执行与本地接口类似的操作(尽管大多数容器会意识到您实际上是在访问“本地”远程接口)。 There can be differences, like spawning a new thread for the remote call, passing values by reference (you can for example turn this on in jboss for in-vm remote calls), etc 可能存在差异,例如为远程调用生成新线程,通过引用传递值(例如,您可以在jboss中为虚拟机内远程调用启用此功能)等
  • serialization is always slow, it should be avoided whenever possible 序列化总是很慢,应尽可能避免
  • basically just don't do it, absolutely no reason to use the remote interfaces unless you plan on splitting your application into multiple EARs 基本上只是不这样做,除非计划将应用程序拆分为多个EAR,否则绝对没有理由使用远程接口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM