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 手机淘宝抓清除消息接口
  • ¥15 C#无selenium
  • ¥15 LD衰减计算的结果过大
  • ¥15 用机器学习方法帮助保险公司预测哪些是欺诈行为
  • ¥15 计算300m以内的LD衰减
  • ¥15 数据爬取,python
  • ¥15 怎么看 cst中一个面的功率分布图,请说明详细步骤。类似下图
  • ¥15 为什么我的pycharm无法用pyqt6的QtWebEngine
  • ¥15 FOR循环语句显示查询超过300S错误怎么办