Home > Documentation, English, Free software, Optimization, Tech Crunch, Varnish > Varnish stops file download after 60 seconds

Varnish stops file download after 60 seconds

Varnish Cache logoThe default installation of Varnish 3 on Debian-based system (including Ubuntu) will set a default timeout for sending files to users (i.e. for users files download) to 60 seconds.

To change this limit, it is necessary to update your default Varnish configuration, in /etc/default/varnish.

For example, if you have something like this:

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -s malloc,256m"

make sure you add the send_timeout param, like this (see the -p line):

DAEMON_OPTS=”-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-p send_timeout=900 \
-s malloc,256m”

This will obviously increase the maximum download time to 900 seconds (15 minutes), which will make it much more practical and less stressfull to download large files.

The logic behind this very short limit is that, if you’re optimizing your site with Varnish, you shouldn’t make it busy with handling one long-term connection with a large file like this (meanwhile, thousands of other connections could have been treated) and your large files should reside on a CDN or something like this.

  1. Joey
    January 31, 2013 at 7:09 pm

    Hi Yannick, many thanks for the tip, we will use it for setting up Varnish since it is next on our list. I have a doubt before setting up Varnish tho… I’m now setting up nginx, and I was wondering if I need to implement any rewrite in the .conf file. I have seen the apache version (.htaccess) of Chamilo has a couple of rewrite rules. Do I need to translate them to nginx rewriting syntax? or should I just go ahead with the default install which forwards the petitions to FPM? Thanks in advance

    • Yannick Warnier
      January 31, 2013 at 11:09 pm

      Hi Joey,
      Indeed, Nginx doesn’t read .htaccess rules, so you would need to translate at least (should be enough) the chamilo/courses/.htaccess file. *Not* translating them will not result in any failure, but it will leave direct access to your courses files possible for anyone, which you probably would like to avoid.

      I haven’t got to translate it to Nginx rules, yet, but I’ve done a bunch of .htaccess-to-nginx translations in the past, so I should be able to do it at some point in the future and add it to the Chamilo install guide. If you can wait for a few weeks, I should be able to do that. If you have suggestions on how to translate them before that, please report them here: http://support.chamilo.org/issues/5939 (just created for you)

  2. Joey
    February 4, 2013 at 6:55 pm

    Hi Yannick, thanks for your reply. If all we need to translate is the .htaccess file on chamilo/courses, then the task is relatively easy. We will attempt to do the rewrites during this week since we need them done sooner than later. Will report our take on your bugtracker when finished so we can double-check they’re ok. Thanks!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: