doucou1892 2011-05-17 17:07
浏览 89
已采纳

连接到WCF Web服务的速度令人费解

My company is currently transitioning from traditional ASMX webservices to WCF webservices, because we need the improved handling of complex types available with WCF.

Whilst investigating performance issues with a web page, I have identified that the biggest (by some margin) performance sinkhole is the initial connection to the WCF service. When I say initial, I mean the following bit of code, every time it is called, a page refresh is enough to get a slow connection:

$client = new SoapClient("<address-to-webservice>",
array('features' => SOAP_SINGLE_ELEMENT_ARRAYS));

Subsequent calls to the methods in this webservice are quick, however the connection is inexplicably slow.

On the same page there is a connection to an ASMX service that is hosted on the same server, which connects much much quicker.

Connection to WCF Webservice took 1.6509809494019 seconds //(this is just calling new SoapClient)
Connection to ASMX Webservice took 0.24430394172668 seconds

Calling ASMX->Method
ASMX->Method returned in 0.011564970016479 seconds

Calling WCF->Method1
WCF->Method1 returned in 0.011118173599243 seconds

Calling WCF->Method2
WCF->Method2 returned in 0.0038959980010986 seconds

Calling WCF->Method3
WCF->Method3 returned in 0.0041651725769043 seconds

This is running on an internal network, and obviously connecting from outside is even slower. As you can see the WCF Webservice connection is considerably slower.

Is there a way to improve performance (considerably) when connecting to the WCF webservice?

UPDATE:

Some information about the WCF Client. Hosted on IIS 7, Windows Server 2008. Using BasicHttpBinding (as the PHP SoapClient doesn't support the more complex wsHttpBinding). The connection is using ssl.

Additionally, when connecting via WCFStorm the connection is much faster, leading me to believe the issue is perhaps with the PHP SoapClient.

  • 写回答

2条回答 默认 最新

  • douhuxi4145 2011-05-18 11:40
    关注

    Our problem has been resolved by fixing the location of soap.wsdl_cache_dir in php.ini.

    Our websites were hosted and developed on Windows machines, so the default directory of '/tmp' didn't work. Changing this to C:\Windows\Temp has meant although the initial connection is still slow, all subsequent requests are fast.

    We will now look into using a more common solution of a warm-up script.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作