Server Stall

This is a discussion on Server Stall within the PHP General forums, part of the PHP Programming Forums category; Hi, One of my scripts are using wget to get external xml data $fp = popen ("wget -O - '".$dst.&...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-05-2007
Sancar Saran
 
Posts: n/a
Default Server Stall

Hi,

One of my scripts are using wget to get external xml data

$fp = popen ("wget -O - '".$dst."' | cat","r");

Some time $dst host responds very slowly. And that time if I open another
connection to same server the second request waits to complete wget
operation.

I'm very noobie about this file operations. Is there any suggestion about this
situation ?

Regards.

Sancar
Reply With Quote
  #2 (permalink)  
Old 02-06-2007
Richard Lynch
 
Posts: n/a
Default Re: [PHP] Server Stall

On Mon, February 5, 2007 11:42 am, Sancar Saran wrote:
> Hi,
>
> One of my scripts are using wget to get external xml data
>
> $fp = popen ("wget -O - '".$dst."' | cat","r");
>
> Some time $dst host responds very slowly. And that time if I open
> another
> connection to same server the second request waits to complete wget
> operation.
>
> I'm very noobie about this file operations. Is there any suggestion
> about this
> situation ?


If you are trying to open multiple streams in a single PHP script in
parallel, you want http://php.net/stream_select

If you are just testing it with another script, and they are both
taking a long time, that just means that $dst is slow right now.

I would also suggest that you pull out the wget part and put it into a
cron job, and then let PHP use the most recent download from wget
that's available. That way, your script isn't sitting around waiting
for a slow download. It just runs at max speed on the local file
which is the most recent download available. It sounds bassackwards,
but ends up being a much easier solution, as well as a better user
experience, and more maintainable, as you've pulled the whole wget
mess out of the PHP script and modularized it.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:17 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0