How to download your files 10 times faster

7 replies
Let's say you want to make a backup of your files from your site. On many hosts, including GoDaddy, downloading individual, small files takes way much longer than downloading one big file.

How to increase the speed of your download:

1. Create a local file, called download.php, with the following content.
PHP Code:
<?php 
    $zip 
shell_exec('zip -r download.zip ./');
    echo 
"I zipped all";
?>
3. Upload download.php in the desired location
(let's say, in http://yoursite.com/test)

2. From all your files and folders, create a zip archive, called download.zip
Run http://yoursite.com/test/download.php
to zip the files on your server.

3. Download the download.zip file

See also:
How to upload your files 10 times faster
#download #faster #files #times
  • Profile picture of the author gdclarke
    tar and scp from the command line work pretty well too.
    {{ DiscussionBoard.errors[199097].message }}
  • Profile picture of the author prashant32
    Banned
    [DELETED]
    {{ DiscussionBoard.errors[202560].message }}
  • Profile picture of the author HunkMoneyLuke
    99% of the time, download speeds are limited by your local internet connection speed. Zipping files will only save you download time if the files are highly compressible. Files that are already using a compression algorithm like mp3, wmv, etc, will not compress down much further.

    You really want to download your files 10X faster? Bump your internet connection up by 10X.
    {{ DiscussionBoard.errors[202658].message }}
    • Profile picture of the author ForumJoiner
      Originally Posted by HunkMoneyLuke View Post

      99% of the time, download speeds are limited by your local internet connection speed.
      and by the speed of upload, set by the company that hosts your file.
      I'm talking about compressing mainly php and html files, which are highly compressible. From one file of 2MB to hundred of little files of a total of 8MB there is a big difference.

      It's something similar to downloading a sql database as an sql file or as a compressed file. Only, for regular FTP, there is no simple way to do this if you don't have a command line interface available.

      In case for you it's the same, I envy you for your hosting account.

      This article were for the not so lucky ones.

      Sergiu FUNIERU
      {{ DiscussionBoard.errors[202679].message }}
      • Profile picture of the author zapseo
        ForumJoiner is completely correct.

        You have to measure your downloads by how many bytes actually have to be transmitted.

        For each file, there is a certain amount of communications protocol overhead.

        Sometimes the number of bytes that have to be transmitted just to handle the communications protocol can be larger than the file being transmitted!

        Further more, in the communications protocol, there's not only the overhead of the number of additional bytes, but also the back and forth communication that has to occur. Which is something like this: 1. "Are you there?" 2:"Yes, I'm here, what do you need?" 1. "I need file xyz" 2. "okay, here's xyz" 1. "okay, got it!"

        (this is a VERY simplistic view, provided to illustrate the problem.)

        So ... if you have to only do that for 1 file, it's going to speed up your downloads significantly -- both by reducing the # of bytes and reducing the amount of time taken up in the back-and-forth communication between the two sites.

        So the time savings has -- my guess -- far less to do with compressing the files, but in the reduction of the communications protocol overhead.

        And thanks, ForumJoiner -- I've actually been planning to write something like that -- but, since I don't write php every day, it would have taken me a bit of time to trackdown the code and test it.

        Appreciate it. Should save folks a lot of time.

        (Note: I do have command-line access to some, but not all, of my hosts. As someone who used to administer Sun Solaris systems as a part of my job -- no, I wasn't a sysadmin, but sysadmin duties were part of my job -- I frequently ache for my ready-to-use command line access...)

        Live JoyFully!

        Judy Kettenhofen, Profit Strategist/Copywriter
        NextDay Copy
        {{ DiscussionBoard.errors[203346].message }}
  • Profile picture of the author awesometbn
    Unless your server employs output buffering, it is possible to compress your PHP files via gzip-encoding. Browsers and other user-agents capable of interpreting gz-encoded data will employ the compressed content, while other user-agents will utilize the content uncompressed. Simply place the following code before the (X)HTML content in any PHP script:

    Code:
    if ( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') ) {
       ob_start("ob_gzhandler"); 
     										} else { 
       ob_start();
     										}

    For more information see, http://perishablepress.com/press/2007/03/26/fast-effective-php-compression/
    {{ DiscussionBoard.errors[204466].message }}

Trending Topics