r5258 - 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
Wed Sep 22 13:21:32 CEST 2010


Author: tfheen
Date: 2010-09-22 13:21:32 +0200 (Wed, 22 Sep 2010)
New Revision: 5258

Added:
   branches/2.1/varnish-cache/doc/sphinx/tutorial/handling_misbehaving_servers.rst
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/advanced_backend_servers.rst
   branches/2.1/varnish-cache/doc/sphinx/tutorial/increasing_your_hitrate.rst
   branches/2.1/varnish-cache/doc/sphinx/tutorial/index.rst
   branches/2.1/varnish-cache/doc/sphinx/tutorial/vcl.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 r4852: probes, grace, saint



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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170

Modified: branches/2.1/varnish-cache/doc/sphinx/tutorial/advanced_backend_servers.rst
===================================================================
--- branches/2.1/varnish-cache/doc/sphinx/tutorial/advanced_backend_servers.rst	2010-09-22 11:17:28 UTC (rev 5257)
+++ branches/2.1/varnish-cache/doc/sphinx/tutorial/advanced_backend_servers.rst	2010-09-22 11:21:32 UTC (rev 5258)
@@ -78,6 +78,8 @@
 requests to the healthy server? Sure it can. This is where the Health
 Checks come into play.
 
+.. _tutorial-advanced_backend_servers-health:
+
 Health checks
 -------------
 
@@ -124,8 +126,6 @@
 threshold 
  How many of the .window last polls must be good for the backend to be declared healthy.
 
-XXX: Ref to reference guide.
-
 Now we define the director.::
 
   director example_director round-robin {
@@ -141,4 +141,6 @@
 
 You use this director just as you would use any other director or
 backend. Varnish will not send traffic to hosts that are marked as
-unhealty.
+unhealty. Varnish can also serve stale content if all the backends are
+down. See :ref:`tutorial-handling_misbehaving_servers` for more
+information on how to enable this.

Copied: branches/2.1/varnish-cache/doc/sphinx/tutorial/handling_misbehaving_servers.rst (from rev 4852, trunk/varnish-cache/doc/sphinx/tutorial/handling_misbehaving_servers.rst)
===================================================================
--- branches/2.1/varnish-cache/doc/sphinx/tutorial/handling_misbehaving_servers.rst	                        (rev 0)
+++ branches/2.1/varnish-cache/doc/sphinx/tutorial/handling_misbehaving_servers.rst	2010-09-22 11:21:32 UTC (rev 5258)
@@ -0,0 +1,76 @@
+.. _tutorial-handling_misbehaving_servers:
+
+Misbehaving servers
+-------------------
+
+A key feature of Varnish is its ability to shield you from misbehaving
+web- and application servers.
+
+
+
+Grace mode
+~~~~~~~~~~
+
+When several clients are requesting the same page Varnish will send
+one request to the backend and place the others on hold while fetching
+one copy from the back end. 
+
+If you are serving thousands of hits per second this queue can get
+huge. Nobody likes to wait so there is a possibility to serve stale
+content to waiting users. In order to do this we must instruct Varnish
+to keep the objects in cache beyond their TTL. So, to keep all objects
+for 30 minutes beyond their TTL use the following VCL:::
+
+  sub vcl_fetch {
+    set beresp.grace = 30m;
+  }
+
+Varnish still won't serve the stale objects. In order to enable
+Varnish to actually serve the stale object we must enable this on the
+request. Lets us say that we accept serving 15s old object.::
+
+  sub vcl_recv {
+    set req.grace = 15s;
+  }
+
+You might wonder why we should keep the objects in the cache for 30
+minutes if we are unable to serve them? Well, if you have enabled
+:ref:`tutorial-advanced_backend_servers-health` you can check if the
+backend is healthy and serve the content for as longer.::
+
+   if (! req.backend.healthy) {
+      set req.grace = 5m;
+   } else {
+      set req.grace = 15s;
+   }
+  
+Saint mode
+~~~~~~~~~~
+
+Sometimes servers get flaky. They start throwing out random
+errors. You can instruct Varnish to try to handle this in a
+more-than-graceful way - enter *Saint mode*. Saint mode enables you to
+discard a certain page from one backend server and either try another
+server or serve stale content from cache. Lets have a look at how this
+can be enabled in VCL:::
+
+  sub vcl_fetch {
+    if (beresp.status == 500) { 
+      set beresp.saintmode = 10s;
+      restart;
+    }
+    set beresp.grace = 5m;
+  } 
+
+When we set beresp.saintmode to 10 seconds Varnish will not ask *that*
+server for URL for 10 seconds. A blacklist, more or less. Also a
+restart is performed so if you have other backends capable of serving
+that content Varnish will try those. When you are out of backends
+Varnish will serve the content from its stale cache.
+
+This can really be a life saver.
+
+God mode
+~~~~~~~~
+Not implemented yet. :-)
+

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-22 11:17:28 UTC (rev 5257)
+++ branches/2.1/varnish-cache/doc/sphinx/tutorial/increasing_your_hitrate.rst	2010-09-22 11:21:32 UTC (rev 5258)
@@ -25,9 +25,10 @@
 there are quite clueful. So its interesting to look at their HTTP
 Headers. Lets send a GET requst for their home page.::
 
-  $ GET -H 'Host: vg.no' -Used http://vg.no/ 
-  GET http://www.vg.no/
-  User-Agent: Rickzilla 1.0
+  $ GET -H 'Host: www.vg.no' -Used http://vg.no/
+  GET http://vg.no/
+  Host: www.vg.no
+  User-Agent: lwp-request/5.834 libwww-perl/5.834
   
   200 OK
   Cache-Control: must-revalidate
@@ -59,10 +60,10 @@
 Firefox plugins
 ~~~~~~~~~~~~~~~
 
-There are also a couple of great plugins for Firefox. Both *Live HTTP
-Headers* and *Firebug* can show you what headers are beeing sent and
-recieved. Try googling for them if you want to check them out. They
-are both recommended.
+There is also a plugin for Firefox. *Live HTTP Headers* can show you
+what headers are beeing sent and recieved. Live HTTP Headers can be
+found at https://addons.mozilla.org/en-US/firefox/addon/3829/ or by
+googling "Live HTTP Headers".
 
 
 The role of HTTP Headers
@@ -124,15 +125,19 @@
 like removing one out of several cookies, things get
 difficult. Unfornunatly Varnish doesn't have good tools for
 manipulating the Cookies. We have to use regular expressions to do the
-work.
+work. If you are familiar with regular expressions you'll understand
+whats going on. If you don't I suggest you either pick up a book on
+the subject, read through the *pcrepattern* man page or read through
+one of many online guides.
 
 Let me show you what Varnish Software uses. We use some cookies for
 Google Analytics tracking and similar tools. The cookies are all set
 and used by Javascript. Varnish and Drupal doesn't need to see those
 cookies and since Varnish will cease caching of pages when the client
-sends cookies we will discard these unnecessary cookies in VCL.
+sends cookies we will discard these unnecessary cookies in VCL. 
 
-In the following VCL we discard all cookies that start with a underscore.::
+In the following VCL we discard all cookies that start with a
+underscore.::
 
   // Remove has_js and Google Analytics __* cookies.
   set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(_[_a-z]+|has_js)=[^;]*", "");

Modified: branches/2.1/varnish-cache/doc/sphinx/tutorial/index.rst
===================================================================
--- branches/2.1/varnish-cache/doc/sphinx/tutorial/index.rst	2010-09-22 11:17:28 UTC (rev 5257)
+++ branches/2.1/varnish-cache/doc/sphinx/tutorial/index.rst	2010-09-22 11:21:32 UTC (rev 5258)
@@ -30,6 +30,7 @@
         statistics.rst
         increasing_your_hitrate.rst
 	advanced_backend_servers.rst
+        handling_misbehaving_servers.rst
 	troubleshooting.rst
 
 .. todo::

Modified: branches/2.1/varnish-cache/doc/sphinx/tutorial/vcl.rst
===================================================================
--- branches/2.1/varnish-cache/doc/sphinx/tutorial/vcl.rst	2010-09-22 11:17:28 UTC (rev 5257)
+++ branches/2.1/varnish-cache/doc/sphinx/tutorial/vcl.rst	2010-09-22 11:21:32 UTC (rev 5258)
@@ -56,3 +56,6 @@
 trigger ESI processing, try alternate backend servers in case the
 request failed.
 
+
+Example one
+~~~~~~~~~~~


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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,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,4859-4861,4864-4868,4912,4967-4968,4971,4973-4975,4977,4979-4981,4986,4989,5016,5048,5162,5170




More information about the varnish-commit mailing list