WCF与现行分布式通讯技术性能对比

1:前言

WCF是FrameWork3.0下的分布式框架。

本文讨论WCF与现行分布式通讯框架的性能对比。要求阅读者有一定的WCF基础(可以参照Windows Communication Foundation Architecture Overview)。

2:目标

本文的目的是WCF与现存的分布式通讯技术进行对比。这些现存的分布式通讯结构如下:

  • ASP.NET Web Services (ASMX)
  • Web Services Enhancements (WSE)
  • .NET Enterprise Services (ES)
  • .NET Remoting

    本文中提供的场景和技术对于理解不同技术的性能来说非常有用,但是不能作为选择某项架构的决定因素。因为优秀的SOA架构依赖于服务本身而不在于通讯技术。

    3:对比

    所收集的数据来自于相同的硬件环境。如图14所示。提供足够多的客户端使服务端满负荷运行。测试过程中的数据为平均数值。本为旨在比较“吞吐量”图表中的线段越高性能越优越。

    3.1 ASP .NET Web Services (ASMX)

    本次比较WebService和WCF,比较的内容是客户端和服务端交互的性能。客户端请求整型的数据服务端获取请求分别返回1,10以及100个对象的数组。

    服务端方法为

    Code

    3.1.1 IIS Hosted Interoperable Basic Profile 1.0 Web Service

    (单核)
    (四核)

    单核处理器下传输110100个对象数组WCF吞吐量比ASMX27%31%48%

    四核处理器下传输110100个对象数组WCF吞吐量比ASMX19%21%36%

    3.1.2 IIS Hosted Interoperable Basic Profile 1.0 Web Service using Transport Security

    (单核)

    (四核)

     

    单核处理器下传输110100个对象数组WCF吞吐量比ASMX16%18%26%

    四核处理器下传输110100个对象数组WCF吞吐量比ASMX5%12%13%

    3.2 Web Services Enhancements (WSE)

    本部分对比WCF和增强WebService之间的吞吐量。本部分是WSE2.0,顺便说一下WSE2.0和WSE3.0的吞吐量差不多。

    3.2.1 IIS Hosted Interoperable Web Service using WS-Security

    本部分消息采用 X. 509 证书,WCF用WSHttpBinding绑定。该绑定WS-Security 1.1类似。采用HTTP通讯。

    (单核)

    (四核)

    无论单双核在吞吐量上WCF是WSE(增强)的4倍。

    3.3 .NET Enterprise Services (ES)

    本部分对比ES和WCF的吞吐量,主要通过两种数据类型。一种是常见的数据类型(primitive )一种是类(order )。

    Code

    本场景中WCFself hosted,NetTcpBinding

    3.3.1 Self-Hosted Request/Reply TCP Application

    (单核)

    (四核)

    单核模式下ES传递常用数据类型的效率是WCF高21%而传递引用类型的时候WCF比ES高149%

    四核模式下WCF传递常用数据类型的效率是ES高7%而传递引用类型的时候WCF比ES高104%

    3.3.2 Self-Hosted Secure Request/Reply TCP Application

    (单核)

    (四核)

    单核模式下ES传递常用数据类型的效率是WCF高24%而传递引用类型的时候WCF比ES高69%

    四核模式下ESF传递常用数据类型的效率是WCF高16%而传递引用类型的时候WCF比ES高37%

    3.3.3 Secure Transacted Request/Reply TCP Application

    该情况下两种技术相差无极

    3.4 .NET Remoting

    (单核)

    (四核)

    单核模式下WCF优于Remoting29%,30%在传输128 bytes and 4k bytes。当查传输256bytes时相差无几。

    四核模式下WCF优于Remoting38%,18%,28%在有效负载是128bytes,4bytes,256bytes。

    4:结论

  • When migrating distributed applications written with ASP.NET Web Services, WSE, .NET Enterprise Services and .NET Remoting to WCF, the performance is at least comparable to the other existing Microsoft distributed communication technologies. In most cases, the performance is significantly better for WCF over the other existing technologies. Another important characteristic of WCF is that the throughput performance is inherently scalable from a uni processor to quad processor.

  • To summarize the results, WCF is 25%—50% faster than ASP.NET Web Services, and approximately 25% faster than .NET Remoting. Comparison with .NET Enterprise Service is load dependant, as in one case WCF is nearly 100% faster but in another scenario it is nearly 25% slower. For WSE 2.0/3.0 implementations, migrating them to WCF will obviously provide the most significant performance gains of almost 4x.

    5性能测试设备

    图14

    图14显示了机器配置是一台服务器和4个客户机连接的两个1 Gbps以太网网络接口。 该服务器是AMD64 2.2 GHz的四核处理器,Windows Server 2003 SP1操作系统。每个客户机为双处理器的AMD 64 2.2GHz处理器。该系统的CPU利用率保持在近100%。主机使用的是Internet信息服务( IIS ) 6.0服务器。 

  • 原文地址:https://www.cnblogs.com/tommyli/p/1397434.html