Q:

Delay when downloading Downloadable Products

I have a client who's selling MP3's on his Mage site. These MP3's are pretty big, around 90MB, and when the download link is click in the account area there can be up to a 2 minute delay before the download actually starts. During the delay, the browser shows "Waiting for www.domain.com...". 
I've tried a small file, a couple of kb, and that works quickly, so its obviously something to do with file size.
However, I've replicated the file download outside of Magento and the download starts immediately, even with the 90mb file. Does anyone know what Magento could be doing to cause this delay?
The download script is split between the following 2 files;
Mage/Downloadable/controllers/DownloadController.php::linkAction() 
Mage/Downloadable/Helper/Download.php
I can't see it doing anything out of the ordinary though. Obviously, Magento does A LOT of checks, but those shouldn't change depending on file size.
Bit of a vague one, any help though would be much appreciated.
Thanks, 

A:

As you can see in Mage_Downloadable_DownloadController, the last line of the _processDownload method is $helper->output();
The output function of Mage_Downloadable_Helper_Download reads the file stream and prints it.
public function output() {
  $handle = $this->_getHandle();
  if ($this->_linkType == self::LINK_TYPE_FILE) {
    while ($buffer = $handle->streamRead()) {
      print $buffer;
    }
   }
   ...
}

This might be the reason why it slower when your file download is served via Magento. 

