文本内容是节选自
Choosing Middleware: Why Performance and Scalability do (and do not) Matter
by Michi Henning, Chief Scientist, ZeroC, Inc.
文章的作者也是<基于C++ CORBA高级编程(Advanced CORBA(R) Programming with C++)>的作者
测试环境
Dual-core 2.2GHz Athlon with 2GB of memory running Windows XP Professional SP3.
Dual-core 2.0GHz Mac Mini with 2GB of memory running Windows Vista Ultimate SP1.
编译器
C++ Visual Studio 2008
C# Visual Studio 2008,.NET version 3.5
Java 1.6.0 JDK
编译使用速度优化,对于vista 生成64位代码。ICE 版本 3.30
Latency
延迟是评估中间件的一个重要的因素, 他被定义为由客户端调用服务器,然后接受到结果的时间。最小延迟被定义为函数o(没有输入参数,没有返回值)的调用返回时间。
source code
ICE
interface Latency{
void o(); // Shortest possible operation name
};
WCF
[System.ServiceModel.ServiceContract]
interface Latency {
[System.ServiceModel.OperationContract] void o();
}
RMI
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Latency extends Remote {
void o() throws RemoteException;
}
测试结果
Requests/second
|
Ice for .NET |
Ice for Java |
Ice for C++ |
WCF binary |
WCF SOAP |
RMI |
Loopback |
6,900 |
8,000 |
10,500 |
~6,900 |
~2,300 |
10,600 |
Gigabit network |
2,300 |
2,300 |
2,300 |
~2,190 |
~560 |
2,220 |
Throughput
评估中间件的另一个重要因素是throughput,他是指中间件每秒能传输多少数据。
source code
ICE
sequence<byte> ByteSeq;
interface Throughput {
void sendByteSeq(ByteSeq b);
ByteSeq recvByteSeq();
};
WCF
[ServiceContract]
interface Test {
[OperationContract]
void sendByteSeq(byte[] seq);
[OperationContract]
byte[] recvByteSeq();
}
RMI
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Throughput extends Remote {
int ByteSeqSize = 500000;
void sendByteSeq(byte[] seq) throws RemoteException;
byte[] recvByteSeq() throws RemoteException;
}
测试结果
Throughput loopback |
Ice for .NET |
Ice for Java |
Ice for C++ |
WCF binary |
WCF SOAP |
RMI |
Byte seq (send) |
630Mbit/s |
800Mbit/s |
1,200Mbit/s |
515Mbit/s |
144Mbit/s |
825Mbit/s |
Byte seq (recv) |
610Mbit/s |
720Mbit/s |
960Mbit/s |
550Mbit/s |
165Mbit/s |
800Mbit/s |
Throughput Gigabit network |
Ice for .NET |
Ice for Java |
Ice for C++ |
WCF binary |
WCF SOAP |
RMI |
Byte seq (send) |
520Mbit/s |
660Mbit/s |
740Mbit/s |
425Mbit/s |
140Mbit/s |
283Mbit/s |
Byte seq (recv) |
410Mbit/s |
590Mbit/s |
655Mbit/s |
370Mbit/s |
130Mbit/s |
280Mbit/s |