Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would at first like to thank everyone at serverfault for this great website and I also come to this site while searching in google for various server related issues and setups.

I also have an issue today and so I am posting here and hope that the seniors would help me out. I had setup a website on a dedicated server a few days ago and I used Varnish 3 as the frontend to Apache2 on a Debian Lenny server as the traffic was a bit high. There are several static file downloads of around 10-20 MB in size in the website. The website looked fine in the last few days after I setup. I was checking from a 5mbps + broadband connection and the file downloads were also completed in seconds and working fine.

But today I realized that on a slow internet connection the file downloads were breaking off. When I tried to download the files from the website using a browser then it broke off after a minute or so. It kept on happening again and again and so it had nothing to do with the internet connection. The internet connection was around 512 kbps and so it was not dial up level speed too but decent speed where files should easily download though not that fast.

Then I thought of trying out with the apache backend port and used the port number to check out if the problem occurs. But then on adding the apache port in the static file download url, the files got downloaded easily and did not break even once. I tried it several times to make sure that it was not a coincidence but every time I was using the apache port in the file download url then it was downloading fine while it was breaking each time with the normal link which was routed through Varnish I suppose. So, it seems Varnish has somehow resulted in the broken file downloads.

Could anyone give any idea as to why it is happening and how to fix the problem.

For more clarification, take this example:

Apache backend set on port 8008, Varnish frontend set on port 80

Now when I download say

http://mywebsite.com/directory/filename.extension

Then the download breaks off after a minute or so. I cannot be sure it is due to the time or size though and I am just assuming. May be some other reason too.

But when I download using:

http://mywebsite.com:8008/directory/filename.extension

Then the file download does not break at all and it gets download fine.

So, it seems that varnish is somehow creating the file download breaking and not apache. Does anybody have any idea as to why it is happening and how can it be fixed. Any help would be highly appreciated.

And my varnish default.vcl is

    backend apache {
      set backend.host = "127.0.0.1";
      set backend.port = "8008";
    }

    sub vcl_deliver {
      remove resp.http.X-Varnish;
      remove resp.http.Via;
      remove resp.http.Age;
      remove resp.http.Server;
      remove resp.http.X-Powered-By;
    }
share|improve this question
    
I have been searching for the issue on the internet and I have a few pointers which might suggest that the issue might be due to send_timeout in varnish. Here are a few threads with somewhat similar problems I assume and all of them mention send_timeout osdir.com/ml/web.varnish.misc/2008-05/msg00016.html varnish-cache.org/lists/pipermail/varnish-misc/2009-October/… But can somebody please guide where can I check the send_timeout parameter in varnish 3.0 so that I can change it if needed. Kindly reply. Your help would be highly appreciated. –  Ron Jun 25 '11 at 20:02

2 Answers 2

You are hitting the Varnish send_timeout limit. The default value for send_timeout was 600s, with Varnish 3.0 it was changed to 60s. This may intefere with downloads taking longer than 60s.

You can check the value of the send_timeout parameter with varnishadm:

varnishadm param.show send_timeout

This will output something like:

send_timeout           60 [seconds]
                       Default is 60
                       Send timeout for client connections. If the HTTP
                       response hasn't been transmitted in this many
                       seconds the session is closed. 
                       See setsockopt(2) under SO_SNDTIMEO for more
                       information.

                       NB: This parameter may take quite some time to
                       take (full) effect.

You can set it to 600s with:

varnishadm param.set send_timeout 600s

To make this setting persistent, you have to add "-p sendtimeout 600" to the startup parameters of Varnish. This depends on the distribution you are using. In case of Debian/Ubuntu yo may want to edit /etc/default/varnish.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.