[MEDIUM] introduce the "url_param" balance method
Some applications do not have a strict persistence requirement, yet
it is still desirable for performance considerations, due to local
caches on the servers. For some reasons, there are some applications
which cannot rely on cookies, and for which the last resort is to use
a parameter passed in the URL.
The new 'url_param' balance method is there to solve this issue. It
accepts a parameter name which is looked up from the URL and which
is then hashed to select a server. If the parameter is not found,
then the round robin algorithm is used in order to provide a normal
load balancing across the servers for the first requests. It would
have been possible to use a source IP hash instead, but since such
applications are generally buried behind multiple levels of
reverse-proxies, it would not provide a good balance.
The doc has been updated, and two regression testing configurations
have been added.
diff --git a/tests/test-balance.cfg b/tests/test-balance.cfg
new file mode 100644
index 0000000..f46e531
--- /dev/null
+++ b/tests/test-balance.cfg
@@ -0,0 +1,65 @@
+# This is a test configuration.
+# It tests the "balance" parser for several parameter combinations.
+
+
+global
+ maxconn 10000
+
+defaults
+ balance
+
+defaults
+ balance roundrobin
+
+defaults
+ balance source
+
+defaults
+ balance uri
+
+defaults
+ balance url_param foo
+
+defaults
+ mode tcp
+
+# must produce an error
+#defaults
+# balance url_param
+
+backend tcp-bk1
+ balance
+
+backend tcp-bk2
+ balance roundrobin
+
+backend tcp-bk3
+ balance source
+
+backend tcp-bk4
+ balance uri
+
+backend tcp-bk5
+ balance url_param foo
+
+defaults
+ mode http
+
+backend http-bk1
+ balance
+
+backend http-bk2
+ balance roundrobin
+
+backend http-bk3
+ balance source
+
+backend http-bk4
+ balance uri
+
+backend http-bk5
+ balance url_param foo
+
+# must produce an error
+#backend http-bk6
+# balance url_param