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.