- 浏览: 106203 次
- 性别:
- 来自: 上海
文章分类
最新评论
-
u013246812:
谢谢博主帮我解决了问题,就是那个process.exitVal ...
Java执行Shell脚本超时控制 -
fireinjava:
fireinjava 写道配置好多哦 =.=
刚看了下,原来是 ...
Java Spring2.5 Remote Invoke HTTP Invoker -
fireinjava:
配置好多哦 =.=
Java Spring2.5 Remote Invoke HTTP Invoker -
lee79:
呵呵,讲的很对
Java执行Shell脚本超时控制 -
fangwei:
非常感谢!!!btw 你虽然用到了slf4j,却没有用到它的强 ...
Java执行Shell脚本超时控制
原帖地址:http://daniel.gredler.net/2008/01/07/java-remoting-protocol-benchmarks/
I’ve been analyzing Java remoting protocols at work over the past couple of days, and thought I’d share some of the results here. Specifically, I’m going to share the results of our protocol benchmarking.
Every application will have different requirements in this area, but most criteria will include performance. At the very least, you will want to know how much (if any) performance you are sacrificing for the sake of your other requirements.
The Protocols
The protocols under consideration are Java’s RMI/JRMP, Oracle’s ORMI (with and without HTTP tunneling enabled), Spring’s HttpInvoker, Caucho’s Hessian and Burlap, and three flavors of Apache XML-RPC (Sun-based, HttpClient-based and Lite-based).
RMI/JRMP is Java’s default binary remoting protocol, and its big advantage is that it supports full object serialization of Serializable and Externalizable objects. RMI/JRMP has historically not been as easy to use as some of the other options, but if you’re using Spring (as we are), it’s as easy to use as anything else (except Apache XML-RPC; see below).
ORMI is OC4J’s EJB remoting protocol, which we’re currently using in production. This protocol was originally developed as part of the Orion application server, whose codebase formed the basis for OC4J. The only differentiator between ORMI and RMI/JRMP is likely to be performance. Of course, this protocol probably won’t be an option unless your serverside component is deployed on OC4J. ORMI supports tunneling via HTTP and HTTPS, should you run into firewall or proxy problems.
Spring’s HttpInvoker is another Java-to-Java binary remoting protocol. It’s also very easy to use and supports full object serialization of Serializable and Externalizable objects. The big difference between HttpInvoker and RMI/JRMP is that HttpInvoker transports data via HTTP, which makes it easier to use when you start running into proxy and firewall issues. Unfortunately, HttpInvoker isn’t an option if you’re not using Spring on both the server and the client.
Caucho’s Hessian protocol is a slim, binary cross-platform remoting protocol. Most cross-platform protocols are XML-based, and thus sacrifice a significant amount of performance in order to achieve interoperability. Hessian’s draw is that it achieves cross-platform interoperability with minimal performance degradation. However, Hessian uses a custom reflection-based serialization mechanism which can be troublesome in certain scenarios (think Hibernate proxies).
Currently in a draft state, Hessian 2 is the second incarnation of the Hessian protocol. You probably don’t want to use it in your production applications quite yet, but it looks very promising. Of course, it’s so easy to switch between Hessian and Hessian 2 that you might want to have a peek just for the heck of it [1].
As far as I can tell, Caucho’s Burlap is essentially Hessian-in-XML. As such, Burlap is not a binary protocol and should be expected to suffer accordingly in the performance department. This being the case, I haven’t been able to figure out exactly why anyone would choose to use Burlap instead of Hessian… aside from a requirement from the marketing department that your RPC be buzzword compliant.
Apache XML-RPC is Apache’s implementation of XML-RPC, an XML-based RPC specification which focuses on interoperability. Apache XML-RPC may be a bit more difficult to set up than the other options if you’re using Spring. The infrastructure for the other protocols is built into the Spring framework, but you’ll have to write the Apache XML-RPC / Spring integration yourself.
Apache XML-RPC supports a number of transport factories under the covers. The three transport factories tested were the default transport factory (based on Sun’s HttpURLConnection), the HttpClient transport factory (based on HttpClient) and the Lite transport factory (based on an Apache XML-RPC minimal HTTP client implementation).
The Configuration
The test consisted of remote invocations to a single method which takes an integer size parameter and returns a list of the specified size. The objects in the returned list each contained 10 instance variables (4 strings of about 40 characters each, 2 dates, 1 long, 1 integer, 1 double and 1 float, none of which were null). The lists returned were static, so there was no list construction overhead.
The results of the first 10 invocations were thrown away, in order to allow the VMs to “warm up.” The next 100 invocations were tallied and averaged.
The tests were performed on a Windows XP SP2 machine with 2GB of RAM and a 2Ghz Core 2 Duo CPU, using Sun’s JVM 1.5.0_09. The client and server were run in two separate VMs on the same host, in order to avoid spurious networking artifacts [2].
The following library versions were used: Spring 2.0.6, Jetty 6.1.5, OC4J 10.1.3.2.0, slf4j 1.4.3, log4j 1.2.14, Apache XML-RPC 3.1, Commons HttpClient 3.1, and Caucho Hessian 3.1.3.
Spring was used on both the clientside and on the serverside in order to hide the remoting details from the interface consumer and implementor. All serverside components were run inside a single Jetty servlet container, except for the ORMI serverside testing components which were run in OC4J.
Vendor extensions and GZIP requesting were enabled for all Apache XML-RPC tests. Streaming and GZIP compressing were enabled for all Apache XML-RPC tests except the Lite tests (the Lite transport factory does not support these options). These configurations represent the best performance optimizations available to the various Apache XML-RPC flavors.
The Results
The following graph illustrates the response times of the various protocols for invocations returning smaller lists:
The following graph illustrates the response times of the various protocols for invocations returning larger lists:
Conclusion
It’s important to note that no general conclusions can be derived from the absolute numbers represented above. Rather, the numbers must be examined relative to each other.
That said, the following observations may be made:
- The binary protocols (RMI, ORMI, HttpInvoker and Hessian) are always faster than the XML-based protocols (Burlap and the Apache XML-RPC variants) — except for ORMI with HTTP tunneling enabled.
- Performance is pretty even amongst the binary protocols — except for Hessian, which performs well only when compared to the XML-based protocols, and ORMI with HTTP tunneling enabled, which performs on a par with the XML-RPC variants.
- Burlap has much better performance than the XML-RPC variants.
- Native RMI and Hessian 2 have the best performance until the remote method invocations start returning larger lists, at which point vanilla ORMI takes a slight lead.
- Changing Apache XML-RPC’s transport factory does not seem to have a very large effect on performance.
- It’s amazing how fast standard ORMI is, compared to ORMI with HTTP tunneling enabled.
- Hessian 2 bears watching!
Other Interesting Links
JBoss Remoting Framework Benchmarks: Tom Elrod’s benchmark of the JBoss Remoting framework. Includes part of the Spring Remoting framework.
Nominet’s Protocol Benchmarks: Interesting benchmark of many of the protocols here considered. Intriguingly, HttpInvoker is found to have consistently better performance than RMI/JRMP, a finding which contradicts our results.
Footnotes
[1] If you’re using Spring’s Hessian integration and the latest Hessian JARs, moving to Hessian 2 is as easy as adding the following property to your HessianProxyFactoryBean:
[2] The tests were later run on two separate machines over a controlled network, in order to verify that the local tests are representative; they are.
发表评论
-
Spring声明式事务管理与配置详解
2015-08-18 09:00 01、Spring声明式事务配置的五种方式 前段时间对 ... -
Log4j的配置与使用详解
2015-08-18 08:44 7771、介绍 Log4j是Apache的一个开放源代码项目 ... -
Web.xml
2015-08-18 08:35 438web.xml文件详解 前言:一般的 ... -
Spring Filter
2015-08-18 08:23 5151、简介 Filter也称 ... -
springSecurity源码分析——DelegatingFilterProxy类的作用
2014-12-16 13:56 704http://www.cnblogs.com/hzhu ... -
spring data jpa 中的OpenEntityManagerInViewFilter 取代OpenSessionInViewFilter
2014-12-05 13:52 0http://blog.csdn.net/lzwglory/ ... -
servlet tomcat web.xml配备信息说明
2014-12-05 13:50 0servlet tomcat web.xml配置信息说明 ... -
Spring IntrospectorCleanupListener
2014-12-05 12:40 662spring中提供了一个名为 org.springfr ... -
Spring IOC容器实例化Bean的方式与RequestContextListener应用
2014-12-05 12:35 1071spring IOC容器实例化Be ... -
SpringBean的5种作用域
2014-12-05 12:33 798org.springframework.web.contex ... -
Lobback日志文件
2014-12-05 12:29 1179Logback是由log4j创始人Ceki Gülcü设计的 ... -
HTML Element
2012-08-05 17:16 9631. select 1) Clear Select O ... -
Prototype Study (转)
2012-08-05 16:49 806什么是Prototype Prototype 是由 S ... -
Prototype Element
2012-08-05 16:46 9311. select <select name=&q ... -
IE Firefox 一些组件的特殊处理
2012-07-29 09:04 8781、html alt 在IE下控件的alt属性使用赋值后,当 ... -
log4j 自动生成 appender
2011-05-04 21:55 1671一般log4j的配置是通过log4j.properties或x ... -
Java ASP Post
2011-03-06 20:32 1191用Java编写的模拟ASP Post请求写的一个上海的违章查询 ... -
Java Spring2.5 Remote Invoke HTTP Invoker
2011-03-06 20:16 2696近日,一个项目涉及到 ... -
Java Spring1.2 Remote Invoke HTTP Invoker
2011-02-25 09:12 1317近日,一个项目涉及到系统间接口调用,考虑到系统间用的都是jav ... -
File Encoding Converter
2009-11-13 16:52 1702在Java应用开发中,经常会遇到不同的开发人员的IDE设置的文 ...
相关推荐
它包括:基于 TCP 的通信协议、数据序列化、Java 类加载。 该库可在 Jenkins 之外重用。 下载 Jenkins Remoting 库作为 Jenkins 发行版的一部分提供,建议使用那里的版本以确保与您的 Jenkins 实例兼容。 您可以从...
《ares-remoting:迷你版Dubbo源代码解析——分布式服务注册与调用揭秘》 在IT行业中,分布式服务已经成为大型系统架构的核心组成部分,而Dubbo作为阿里巴巴开源的一款高性能、轻量级的服务治理框架,备受业界关注...
.NETRemoting提供了一种允许对象通过应用程序域与另一对象进行交互的框架。这种框架提供了多种服务,包括激活和生存期支持,以及负责与远程应用程序进行消息传输的通讯通道。格式化程序用于在消息通过通道传输之前,...
Jetlang Remoting项目提供用于连接分布式系统的api。 Jetlang为异步分布式消息传递提供了语言不可知的线级协议和线程模型。 该库还包含客户端和服务器Websocket实现。 最新版本可在Maven存储库中获得。 #...
寓言远程处理 Fable.Remoting是Fable和.NET应用程序的通讯层,它抽象了Http和Json,让您仅根据在编译时进行静态检查的纯无状态函数... |> Remoting.fromValue greetingApi 从客户端调用函数 // get a typed-proxy for
at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.returnFromResponse(DefaultFuture.java:190) at com.alibaba.dubbo.remoting.exchange.support.DefaultFuture.get(DefaultFuture.java:110) at ...
利用rmi远程调用,实现客户端和服务器端的通讯,而不是采用socket的编程方法。
【Java中的`java.net.BindException: Address already in use: JVM_Bind`异常】 在Java编程中,当你尝试启动一个服务器端应用,如Tomcat,或者任何需要监听特定端口的服务时,可能会遇到`java.net.BindException: ...
异步远程处理类 这个包包括: Node.js 远程连接,一个使用 NodeRelay(感谢 Bruno Garcia),另一个没有。 用于从接口或服务器远程处理类构建异步客户端代理远程处理类的宏。 所有服务器类都被排除在客户端之外。...
远程桌面协议(Remote Desktop Protocol,简称RDP)是由微软开发的一种专用于远程访问的技术,它允许用户通过网络连接并控制另一台计算机。RDP协议不仅支持基本的远程连接功能,还能够提供高质量的图形显示和多媒体...
Direct Web Remoting (DWR) 是一个开源的Java库,它允许Web应用程序在客户端的JavaScript和服务器端的Java之间进行直接的、异步的通信,实现了Web应用中的Ajax功能。DWR通过自动化处理JavaScript和Java之间的类型...
1. 泛型和Remoting:.NET 2.0及更高版本引入泛型,可以提高Remoting对象的性能和类型安全性。 2. 持久化:通过实现`ISerializable`接口,可以实现远程对象状态的持久化,即使服务器重启也能恢复状态。 3. 自定义...
- Spring Remoting:Spring框架提供的远程方法调用支持。 - ActiveMQ:一个开源的消息代理和面向消息的中间件。 - Mule ESB:一个开源的企业服务总线。 Java远程技术广泛应用于各种需要远程通信的Java应用开发中...
Remoting事件,特别是服务端广播的改进,是.NET Framework中一项关键的技术,它允许应用程序进行跨进程甚至跨网络的通信。这项技术的核心在于提供了一种透明的方式,使得对象可以像在本地内存中一样在远程进程中操作...
**Remoting:** .NET Remoting是.NET Framework早期版本中的远程调用技术,主要用于.NET应用程序之间的通信。它提供了优化的二进制格式,降低了网络传输的成本,但在跨域、跨平台方面受限,且不支持HTTP,不适用于...
DWR(Direct Web Remoting)是一个用于改善web页面与Java类交互的远程服务器端Ajax开源框架,可以帮助开发人员开发包含AJAX技术的网站。它可以允许在浏览器里的代码使用行在WEB服务器上的JAVA函数,就像它就在浏览器...
3. ** Pure Java Remoting:** 如果不使用BlazeDS或LCDS,开发者也可以直接使用HTTP、SOAP或RESTful Web服务接口来实现Flex与Java的通信。Flex可以使用HTTPService或WebService组件来调用Java的Web服务接口,通过XML...