几种基于HTTP协议的RPC性能比较

几种基于HTTP协议的RPC性能比较
今天写个程序测试了一下Axis(SOAP), Hessian(Binary), Burlap(XML-RPC), REST的性能。

服务端的是一个简单的加密、解密方法,各种协议使用同一个实现的代码。
客户端是独立的java程序,分别用各种协议对服务端的方法进行调用。每一种协议循环调用n次,然后取平均值。

循环1,000次的测试
第一次

Axis --------------->> Total time: 11123 ms, Avg time: 11.123 ms
Burlap ------------->> Total time:   866 ms, Avg time:  0.866 ms
Hessian ------------>> Total time:   581 ms, Avg time:  0.581 ms
REST --------------->> Total time:   929 ms, Avg time:  0.929 ms
AxisUsingWSDL2Java ->> Total time: 11998 ms, Avg time: 11.998 ms
第二次

Axis --------------->> Total time: 11256 ms, Avg time: 11.256 ms
Burlap ------------->> Total time:   816 ms, Avg time:  0.816 ms
Hessian ------------>> Total time:   582 ms, Avg time:  0.582 ms
REST --------------->> Total time:   919 ms, Avg time:  0.919 ms
AxisUsingWSDL2Java ->> Total time: 11908 ms, Avg time: 11.908 ms
循环10,000次的测试
第一次


Axis --------------->> Total time:  88013 ms, Avg time:  8.8013 ms
Burlap ------------->> Total time:   5789 ms, Avg time:  0.5789 ms
Hessian ------------>> Total time:   5162 ms, Avg time:  0.5162 ms
REST --------------->> Total time:   8316 ms, Avg time:  0.8316 ms
AxisUsingWSDL2Java ->> Total time: 112801 ms, Avg time: 11.2801 ms
第二次

Axis --------------->> Total time:  87359 ms, Avg time:  8.7359 ms
Burlap ------------->> Total time:   5784 ms, Avg time:  0.5784 ms
Hessian ------------>> Total time:   5084 ms, Avg time:  0.5084 ms
REST --------------->> Total time:   7983 ms, Avg time:  0.7983 ms
AxisUsingWSDL2Java ->> Total time: 113234 ms, Avg time: 11.3234 ms
测试结果
Hessian最快,Burlap第二,REST第三,Axis最慢。前3种要比Axis快了10倍或者更多。

上面的测试,服务端用的是Resin-3.0.13,出于好奇,我又用Tomcat-5.5.9测试了一把,结果是Resin确实比Tomcat快些。
Tomcat-5.5.9 循环10,000次的测试

Axis --------------->> Total time: 122551 ms, Avg time: 12.2551ms
Burlap ------------->> Total time:   6401 ms, Avg time:  0.6401ms
Hessian ------------>> Total time:   5745 ms, Avg time:  0.5745ms
REST --------------->> Total time:   8090 ms, Avg time:  0.809ms
AxisUsingWSDL2Java ->> Total time: 156908 ms, Avg time: 15.6908ms

你可能感兴趣的:(http协议)