Re: Socket Functions in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 7, 2006 11:22 pm, Oliver John V. Tibi wrote:
> 		while ($data != "") {
> 			$document .= $data;
> 			$data = socket_read( $resource, 1024 );

$logman->append("Read " . strlen($data) . " bytes");

> 		}

This is going to help you pin-point the timing issue.

Is it taking a full minute to read/buffer that data?

Or does it all get sucked down and then a minute is lost?

Or, is it a minute lost and then all the data rushes through?

> 		$logman->append("XML response received.");

> |    40 | 2006-05-03 15:39:28 | XML request sent. Waiting for XML
> response...              |
> |    41 | 2006-05-03 15:40:34 | XML response received.

> As you can see, there is a lapse of more than one minutes between
> LogId's 40 and 41, which is very slow on a production environment. The
> script above acts as a client to another application server listening
> on
> a remote port, running on Java. What the remote application reports is
> that it receives the connection request, receives the request data,
> and
> transmits the response data at the same second, while my application
> receives the response one minute after the request was sent!

How certain are you of the logging on that Java server?...

I've had a similar situation, though we were fighting over 10 seconds
instead of 60, where the other vendor's timings and ours never did
match up.

I'd like to report that we solved the problem...

But since the solution involved ditching that vendor and choosing
another one, I don't think you want to hear about it... :-v

NOTE:
We are a Un*x shop; They were a Windows shop.
Near as I can tell, that right there was the source of the problem...

PS
We went through a lot of hoops with the first vendor to try and work
things out, including installing their application on a Windows server
in our rack (ugh!), to get network lag time to minimum.

They had Admin login on the Windows box, and we told them to do
whatever it takes to get it fast.

We spent a FORTUNE on that box, and waaaaaay too much time trying to
make things work out with them.  Bent over backwards to make it work
before giving up on them.

It was very frustrating, because they kept reporting that their box
was sending things out in X seconds, and we kept seeing 3*X seconds
for how long the data took to arrive. :-(

They kept asking for our source code, and it took them weeks to grasp
that this was all there was to it:
$start = microtime();
$data = file_get_contents($their_url);
$end = microtime();

For some reason, they like it much better when I added a loop such as
you have, even though that only made things worse...

We never did agree on how long it took their box to do things -- I
couldn't even run their test programs locally on that Windows box and
get the same numbers they did...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux