Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 724
  • Last Modified:

PHP PEAR::SOAP performance issue


I am running PEAR::SOAP server with Apache2.0 and PHP4.3.3. Its fully functional except its taking 10 seconds to get the response . I tried to connect to webservices (API) like google, amazon etc and having the same response time problem.

More If i try to connect to a SOAP server running in the same box it still taking the same time.

What am I missing here?

Any Ideas are greatly appreciated.


The following code is taking 10 sec to get the response.

PHP:
--------------------------------------------------------------------------------
<?

require_once 'SOAP/Client.php';

$wsdl_url =  
  'http://soap.amazon.com/schemas3/AmazonWebServices.wsdl';
$WSDL     = new SOAP_WSDL($wsdl_url);  
$client   = $WSDL->getProxy();  

$params   = array(
    'manufacturer' => "Addison Wesley",
    'mode'         => 'books',
    'type'         => 'lite',
    'tag'          => 'Design Patterns',
    'devtag'       => ''
);

$books    = $client->ManufacturerSearchRequest($params);


ECHO "<PRE>";
PRINT_R($books);
ECHO "</PRE>";
?>
0
ITHCI
Asked:
ITHCI
  • 6
  • 6
  • 4
  • +1
1 Solution
 
_GeG_Commented:
I don't think that the problem is with PEAR::SOAP. I think this is a connection issue.

Either you have a slow dns query. You can check it like this:
<?php
echo gethostbyname('soap.amazon.com');
?>
if this takes long, it is a dns problem.

Or maybe your connection is slow, try
<?php
include(''http://soap.amazon.com/schemas3/AmazonWebServices.wsdl');
?>
This only reads the soap service. If this is fast, then it is a PEAR problem.
Otherwise it's a network problem.
0
 
ITHCIAuthor Commented:

I tried the steps, following are the results.

Test 1: Slow DNS :

<?php
echo gethostbyname('soap.amazon.com');
?>

result:  Its displays the ip right away with no lag.

Test2: Connection Slow: (OS: Linux SuSe)

<?php
include(''http://soap.amazon.com/schemas3/AmazonWebServices.wsdl');
?>

result :  It is taking 10 sec to show the result.

Test 3: Connection Slow: (OS: windows XP)

<?php
include(''http://soap.amazon.com/schemas3/AmazonWebServices.wsdl');
?>

result :  It is fast again.

However if I use the same windows box to connect to my SOAP server running in SuSe Linux. Its again taking 10 secs.
windows and Linux boxes are on the same network.



0
 
_GeG_Commented:
test1 is fast on the linux box also?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
davebytesCommented:
I assume you did multiple iterations of each test, at multiple times, and they always respond the same?  I think _GeG_ might be thinking along the same lines I am, which is maybe something is off with your SuSE box -- if it has lags, and the windows box doesn't.  Especially where then connecting the windows box to your SuSE box is slow.  There's enough pieces involved (just apache2 and php alone each with all the various configurable options)...  I assume that no other network services have any problems on the linux box?  Just PHP?  Does Apache/webserving without PHP run into any slowness issues?

Otherwise, sounds like something is off in the PHP build.  Maybe try a different version, etc.?

-d
0
 
ITHCIAuthor Commented:

Yes _GeG_, Test1 is fast on Linux.


DaveBytes, Yes On the Linux box the PHP ver is 4.3.8 and in windows 4.3.3. Right now I am comparing all the On/Off
of both versions php_info();

0
 
ITHCIAuthor Commented:

The comparison goes as follows:

 Variable/option                WIN (running fast)      -         Linux (running Slow)
---------------------         ------------------------              -------------------------
1. Thread Safety                 Enable                                   Disable
2. Hostname port                hostname:0                          localhost:80
3. SSL Support                    disable                                 enable
4. mcrypt                              -                                        enable
5. PHP ver                           4.3.8                                   4.3.3

I know SSL will make the SOAP slow. But Its just enabled, i am not using https://

0
 
ITHCIAuthor Commented:
Finally I installed the versions apache2.0 and php4.3.3 in my windows box.

Windows : Apache/2.0.52 (Win32) PHP/4.3.3

It is behaving the same way as Linux now. Both windows and Linux are slow.
0
 
_GeG_Commented:
maybe it's php 4.3.3? I don't think that ssl is the problem. But I have no idea what the problem is :(
0
 
ITHCIAuthor Commented:
Yes! it is PHP 4.3.3. Thanks a lot for your help.

In windows When I use the

php4apache2.dll  (from windows binary PHP 4.3.3) its SLOW.
php4apache2.dll  (from windows binary PHP 4.3.4) its SLOW.
php4apache2.dll  (from windows binary PHP 4.3.5) its FAST.
php4apache2.dll  (from windows binary PHP 4.3.6) its FAST.
php4apache2.dll  (from windows binary PHP 4.3.7) its FAST.
php4apache2.dll  (from windows binary PHP 4.3.8) its FAST.



0
 
_GeG_Commented:
I feel that I have answered the question
[quote from me] maybe it's php 4.3.3?[/quote]
[quote from ITHCI] Yes! it is PHP 4.3.3. Thanks a lot for your help.[/quote]
0
 
davebytesCommented:
Split the points.  (Note my comment earlier "Otherwise, sounds like something is off in the PHP build.  Maybe try a different version, etc.?")

-d
0
 
moduloCommented:
PAQed with points refunded (500)

modulo
Community Support Moderator
0
 
_GeG_Commented:
just for my information, what is wrong with my answer?
0
 
davebytesCommented:
_GeG_: are you against a point split?  If so, modulo is probably right on -- if not, then he can split the points and close the Q.  I think we both helped equally here.

-d
0
 
ITHCIAuthor Commented:
Hi Every one,

FYI - Both GeG and Dave helped me equally.

However I think upgrading from PHP 4.3.3 to 4.3.5 or newer is not the only solution for this issue.
Coz updating the version is not allways possible (as it may lead to some code changes).

I am sure there sould be some way to make the SOAP run fast with 4.3.3 it self.

0
 
_GeG_Commented:
hi
@davebytes: of course, split would be ok

@ITHCI: I wouldn't be so sure that there is another way. When an update helps solve a probem, most of the time the problem was in the prior version.
But if you feel that you want the points refunded, that is ok by me. I just asked because I was surprised by the decision of modulo

@modulo: I didn't answer davebytes' post, because for me his post was not 'conflicting' mine. For me it seems natural if one party says this is my answer, and the other says, yes I answered it too, the result would be a split. Again, if ITHCI says he/she wants the points refunded, no problem, I was just surprised by your ruling.

Have a good time
0
 
davebytesCommented:
ITHCI -

I'm with GeG on this one.  If a third-party library on top of PHP suddenly breaks a bottleneck issue because of an upgrade of PHP, more likely there was a particular PHP API call that wasn't working as it should.

If you want points refunded, that's fair.  But in this case, we helped you step towards one possible solution.  That isn't the only answer to the question, but it is successful, solves the issue at hand.

-d
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 6
  • 6
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now