r5277 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/doc/sphinx/tutorial varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl

tfheen at varnish-cache.org tfheen at varnish-cache.org
Mon Sep 27 13:59:42 CEST 2010


Author: tfheen
Date: 2010-09-27 13:59:42 +0200 (Mon, 27 Sep 2010)
New Revision: 5277

Modified:
   branches/2.1/
   branches/2.1/varnish-cache/bin/varnishd/cache_backend.h
   branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c
   branches/2.1/varnish-cache/bin/varnishd/vparam.h
   branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc
   branches/2.1/varnish-cache/doc/sphinx/tutorial/increasing_your_hitrate.rst
   branches/2.1/varnish-cache/include/vct.h
   branches/2.1/varnish-cache/include/vev.h
   branches/2.1/varnish-cache/lib/libvarnish/tcp.c
   branches/2.1/varnish-cache/lib/libvarnish/vev.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c
Log:
Merge r4947: Some text on purging and bans. I guess we would need to rename url.purge at some point. This is quite confusing.



Property changes on: branches/2.1
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:4637,4640,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk:4637,4640,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170

Modified: branches/2.1/varnish-cache/doc/sphinx/tutorial/increasing_your_hitrate.rst
===================================================================
--- branches/2.1/varnish-cache/doc/sphinx/tutorial/increasing_your_hitrate.rst	2010-09-27 11:55:31 UTC (rev 5276)
+++ branches/2.1/varnish-cache/doc/sphinx/tutorial/increasing_your_hitrate.rst	2010-09-27 11:59:42 UTC (rev 5277)
@@ -274,12 +274,91 @@
 Purging
 ~~~~~~~
 
+One of the most effective way of increasing your hit ratio is to
+increase the time-to-live (ttl) of your objects. In this twitterific
+day of age serving content that is outdated is bad for business.
 
+The solution is to notify Varnish when there is fresh content
+available. This can be done through two mechanisms. HTTP purging and
+bans. First, let me explain the HTTP purges. 
+
+
 HTTP Purges
 ~~~~~~~~~~~
 
+An HTTP purge is similar to a HTTP GET request, except that the
+*method* is PURGE. Actually you can call the method whatever you'd
+like, but most people refer to this as purging. Squid supports the
+same mechanism. In order to support purging in Varnish you need the
+following VCL in place:::
+
+  acl purge {
+	  "localhost";
+	  "192.168.55.0/24";
+  }
+  
+  sub vcl_recv {
+      	  # allow PURGE from localhost and 192.168.55...
+
+	  if (req.request == "PURGE") {
+		  if (!client.ip ~ purge) {
+			  error 405 "Not allowed.";
+		  }
+		  lookup;
+	  }
+  }
+  
+  sub vcl_hit {
+	  if (req.request == "PURGE") {
+	          # Note that setting ttl to 0 is magical.
+                  # the object is zapped from cache.
+		  set obj.ttl = 0s;
+		  error 200 "Purged.";
+	  }
+  }
+  
+  sub vcl_miss {
+	  if (req.request == "PURGE") {
+
+		  error 404 "Not in cache.";
+	  }
+  }
+
+
+So for vg.no to invalidate their front page they would call out to
+varnish like this:::
+
+  PURGE / HTTP/1.0
+  Host: vg.no
+
+And Varnish would then discard the front page. If there are several
+variants of the same URL in the cache however, only the matching
+variant will be purged. To purge a gzip variant of the same page the
+request would have to look like this:::
+
+  PURGE / HTTP/1.0
+  Host: vg.no
+  Accept-Encoding: gzip
+
 Bans
 ~~~~
 
+There is another way to invalidate content. Bans. You can think of
+bans as a sort of a filter. You *ban* certain content from being
+served from your cache. You can ban content based on any metadata we
+have.
 
+Support for bans is built into Varnish and available in the CLI
+interface. For VG to ban every png object belonging on vg.no they could
+issue:::
 
+  purge req.http.host ~ ^vg.no && req.http.url ~ \.png$
+
+Quite powerful, really.
+
+Bans are checked when we hit an object in the cache, but before we
+deliver it. An object is only checked against newer bans. If you have
+a lot of objects with long TTL in your cache you should be aware of a
+potential performance impact of having many bans.
+
+


Property changes on: branches/2.1/varnish-cache/include/vct.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/include/vct.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/include/vct.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/include/vev.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/include/vev.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/include/vev.h:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170


Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170
   + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4650,4654-4670,4686,4689-4690,4696-4702,4706,4712,4715-4719,4729-4731,4747,4749-4750,4754,4757-4758,4762,4781-4787,4789-4790,4792-4793,4810,4818,4823,4826,4828-4829,4842,4852-4853,4856,4858-4870,4874-4876,4878-4881,4888-4889,4912,4922-4923,4946-4947,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170




More information about the varnish-commit mailing list