[Varnish] #1339: vcl_fetch : configuration order

Varnish varnish-bugs at varnish-cache.org
Mon Sep 9 11:58:11 CEST 2013

#1339: vcl_fetch : configuration order
 Reporter:  flafolie                 |       Type:  defect
   Status:  new                      |   Priority:  normal
Milestone:                           |  Component:  build
  Version:  3.0.3                    |   Severity:  normal
 Keywords:  beresp.ttl hit_for_pass  |
 I'm not sure I'm in the good section to submit this problem.

 The following problem only occured with an high traffic on the server.
 When the traffic is normal, there is no problem.
 With a lot of requests on a file of the type file.js?v=36, I notice an
 anormal CPU use on Varnish process (No problem on apache web servers), it
 seems Varnish makes loops. The file is never cached by Varnish and Varnish
 makes more than 30 sec to finally deliver the file.

 During the problem, if I test with file.js?v=37 (or anything different
 than version currently used : v=36), the file is delivered without delay.

 I can solve the problem switching the order of this 2 tests in vcl_fetch :
         if (!beresp.ttl > 0s) {
             return (hit_for_pass);

  if (req.request == "GET" && req.url ~
                 unset beresp.http.set-cookie;
                 set beresp.http.cache-control = "max-age=2592000";
                 set beresp.ttl = 30d;
                 return (deliver);

 In this order, I got the problem, not in the other order. In the other
 order, my file is correctly cached ans the header age of the file rises

 Is there a reason to this ?

 Thank you

Ticket URL: <https://www.varnish-cache.org/trac/ticket/1339>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list