views:

45

answers:

1

I am using lighttp 1.5 on CentOS release 5.2. The site is a free stock photo site that allows users to download files. Files are around 3-6MB each. The download script is a php script that looks like this.

 set_time_limit(0);
 //...

 header( "Content-Disposition: attachment; filename=\"" . $title . '"' );
 header( "Content-type: image/jpeg");
 header( "Content-Length: " . filesize($file));
 header( "X-LIGHTTPD-send-file: " . $file);

A description of the problem would be I am downloading 5 or 6 different files at once. One of the files 1/2 way through, will start losing k/per sec till it gets to "downloading at 1k per second" and then it just quits. The image never fully arrives. I retry and the image and it downloads fine, even if it takes 5 minutes. Lots of users are reporting this problem and I noticed it at peak times. Ping shows very low packet loss. Anyone have an idea why the connection just drops? Is it lighty or the network? Any help would be greatly appreciated.

A: 

No doubt the gradually declining transfer rate is just an artifact of your browser trying to keep you helpfully informed. In truth, the download stops and never will resume. There could be may reasons for this, but most likely the source site is just overloaded and has thrown your download under a bus. There's noting you can do except seek a more reliable partner.

ddyer
Is there a way to minimize downloads getting thrown under the bus? Is it the network or the server? Its not viable to keep getting a new hosting company, I can ask for a larger connection or more resources.
Michael Connors
Sometimes you get what you pay for - a free site is worth every penny you paid.The problem really could be anywhere. If you think about it, dozens or even hundreds of different computers are involved in moving data between the host computer and yours. In all of these machines, the default response to any difficulty is to just give up and assume the client will retry. The most likely problem is that the host is out of memory or some other scarce resource, and recovers by killing the process that needed what was not available.
ddyer