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 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵