dom_solariumdeparis
asked on
Extremely slow SOAP call
Good day everyone,
I've been having performance issues with the consumption of my web service on my web application. Precisely, every single SOAP request is extremely slow.
To begin with, here is my setup:
- PHP SOAP extension
- PHP v.5.2.14 (Latest)
- The server is running under Linux
- The setting in php.ini soap.wsdl_cache_enabled=1 (Switching this to 0 doesn't seem to affect the performances in any way)
- The SOAP server is situated on the same server (same IP address) as the SOAP client.
I've narrowed my researches and I am 100% sure the problem comes from the server, but I just cannot find where the problem comes from.
When I execute the code below on my local machine using WampServer (PHP 5.2.11), the request is almost instantaneous whereas if I execute the same code on my server, it takes about 5 to 10 seconds before I get the response.
I must be missing something. Normally, the request should be faster when executed on the server since it's consumming a web service locally.
Thank you.
I've been having performance issues with the consumption of my web service on my web application. Precisely, every single SOAP request is extremely slow.
To begin with, here is my setup:
- PHP SOAP extension
- PHP v.5.2.14 (Latest)
- The server is running under Linux
- The setting in php.ini soap.wsdl_cache_enabled=1 (Switching this to 0 doesn't seem to affect the performances in any way)
- The SOAP server is situated on the same server (same IP address) as the SOAP client.
I've narrowed my researches and I am 100% sure the problem comes from the server, but I just cannot find where the problem comes from.
When I execute the code below on my local machine using WampServer (PHP 5.2.11), the request is almost instantaneous whereas if I execute the same code on my server, it takes about 5 to 10 seconds before I get the response.
I must be missing something. Normally, the request should be faster when executed on the server since it's consumming a web service locally.
Thank you.
$client = new SoapClient('http://www.mywebserveraddress.gov/inventory.wsdl');
try {
$response = $client->getProductDescription(5467);
echo '<pre>';
print_r($response);
echo '</pre>';
}
catch (SoapFault $exception)
{
echo $exception;
}
ASKER
a) Yes, both my local setup and the online server are using the built-in SOAP extension
b)
######
Local:#
######
SSL: There is no settings for SSL in the php.ini (This extension is not activated)
CURL: There is no settings for CURL in the php.ini (This extension is not activated)
SOAP:
soap.wsdl_cache_enabled=0
; Sets the directory name where SOAP extension will put cache files.
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
#######
Server:#
#######
CURL (According to phpinfo()):
cURL support enabled
cURL Information libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
OpenSSL (According to phpinfo()):
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
SOAP:
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=1
; Sets the directory name where SOAP extension will put cache files.
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
soap.wsdl_cache_ttl=3600
Comparison of print_r($client):
Local: SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #3 )
Server : SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #3 )
Both are identical.
b)
######
Local:#
######
SSL: There is no settings for SSL in the php.ini (This extension is not activated)
CURL: There is no settings for CURL in the php.ini (This extension is not activated)
SOAP:
soap.wsdl_cache_enabled=0
; Sets the directory name where SOAP extension will put cache files.
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
#######
Server:#
#######
CURL (According to phpinfo()):
cURL support enabled
cURL Information libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
OpenSSL (According to phpinfo()):
OpenSSL support enabled
OpenSSL Version OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
SOAP:
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=1
; Sets the directory name where SOAP extension will put cache files.
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
soap.wsdl_cache_ttl=3600
Comparison of print_r($client):
Local: SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #3 )
Server : SoapClient Object ( [_soap_version] => 1 [sdl] => Resource id #3 )
Both are identical.
ASKER
I missed the following for my local setup in php.ini:
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_ttl=86400
i think there are some differences in the php socket implementations between the windows and linux versions.
(1) try this:
make your soapclient with the following parameter:
$client = new SoapClient('http://www.mywebserveraddress.gov/inventory.wsdl',array('trace' => true));
and see if the print_r does not get more verbose.
(2) do you know if the slow step is the call, making the client, or waiting for the response?
(1) try this:
make your soapclient with the following parameter:
$client = new SoapClient('http://www.mywebserveraddress.gov/inventory.wsdl',array('trace' => true));
and see if the print_r does not get more verbose.
(2) do you know if the slow step is the call, making the client, or waiting for the response?
ASKER
1)
The output does not give more verbose besides the additional parameter:
SoapClient Object ( [trace] => 1 [_soap_version] => 1 [sdl] => Resource id #3 )
2)
I am sure the problem is not the server-side of the SOAP since as I mentionned, my local performs the SOAP request to the server and it works perfectly and I get a response within a few miliseconds.
The problem comes from the client (on the online server), which means it's either the client call or "making the client".
The output does not give more verbose besides the additional parameter:
SoapClient Object ( [trace] => 1 [_soap_version] => 1 [sdl] => Resource id #3 )
2)
I am sure the problem is not the server-side of the SOAP since as I mentionned, my local performs the SOAP request to the server and it works perfectly and I get a response within a few miliseconds.
The problem comes from the client (on the online server), which means it's either the client call or "making the client".
ASKER
3 ) we made a test for client-side SOAP with another dedicated server.
the client side calls the server-side and the result is the same than local call within few milliseconds.
but client-side with server-side on the same server, we get 10 secs for the same request.
the client side calls the server-side and the result is the same than local call within few milliseconds.
but client-side with server-side on the same server, we get 10 secs for the same request.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I seem to have solved the problem with a little config in the php.ini.
I changed the following settings on my online server:
soap.wsdl_cache_ttl=3600 to soap.wsdl_cache_ttl=86400
For some odd reason, the "time to live" drastically affects the performances.
Since then, it is working perfectly fine and everything executes in a record time !
Thank you for your help virmaior. Much appreciated.
I changed the following settings on my online server:
soap.wsdl_cache_ttl=3600 to soap.wsdl_cache_ttl=86400
For some odd reason, the "time to live" drastically affects the performances.
Since then, it is working perfectly fine and everything executes in a record time !
Thank you for your help virmaior. Much appreciated.
ASKER
Although you didn't provide the direct answer to my problem, your guidance helped me to play with the configuration and I finally ended up with the answer.
(1) the server is running linux and you are running windows.
(2) minor difference in version numbers
(a) are both using the built-in SOAP extension?
(b) what are the php.ini settings for soap, ssl, and curl?
I have seen similar issues before with SOAP. I think the SOAP implementation in 5.3 is worse than 5.2.
have you looked at the print_r($client) and compared those two?