How to make multiple clients can get the response at the same time by stream.

Xianzhe Wang wxz19861013 at gmail.com
Mon Jan 28 07:51:19 CET 2013


Hello everyone,
    My varnish version is 3.0.2-streaming release.And I set
"beresp.do_stream  = true" in vcl_fetch in order to "Deliver the object to
the client directly without fetching the whole object into varnish";

This is a part of my *.vcl file:

 sub vcl_fetch {
    set beresp.grace = 30m;

    set beresp.do_stream = true;

    if (beresp.http.Content-Length && beresp.http.Content-Length ~
"[0-9]{8,}") {
       return (hit_for_pass);
    }

     if (beresp.http.Pragma ~ "no-cache" || beresp.http.Cache-Control ~
"no-cache" || beresp.http.Cache-Control ~ "private") {
           return (hit_for_pass);
       }

     if (beresp.ttl <= 0s ||
         beresp.http.Set-Cookie ||
         beresp.http.Vary == "*") {

                set beresp.ttl = 120 s;
                return (hit_for_pass);
     }

    return (deliver);
 }

Then I request a big file(about 100M+) like "xxx.zip" from clients.There is
only one client can access the object.because "the object will marked as
busy as it is delivered."

But if  the request goes directly to “pass” ,multiple clients can get the
response at the same time.

Also if I remove
  if (beresp.http.Content-Length && beresp.http.Content-Length ~
"[0-9]{8,}") {
       return (hit_for_pass);
    }
to make the file cacheable,multiple clients can get the response at the
same time.

Now I want "multiple clients can get the response at the same time." in all
situations("pass","hit","hit_for_pass").

What can I do for it?
Any suggestions  will be appreciate.
Thank you.

 -Shawn Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130128/600d83aa/attachment.html>


More information about the varnish-misc mailing list