aboutsummaryrefslogtreecommitdiffhomepage
path: root/caddytest
diff options
context:
space:
mode:
authorSaber Haj Rabiee <[email protected]>2023-06-20 10:42:58 -0700
committerGitHub <[email protected]>2023-06-20 11:42:58 -0600
commit361946eb0c08791ad16ebc3e82a79512895e650f (patch)
treeb5946e9863f5c48565843996ca75c74e1b9fff82 /caddytest
parent424ae0f420f478e1b38189fd6632d29e13df7eee (diff)
downloadcaddy-361946eb0c08791ad16ebc3e82a79512895e650f.tar.gz
caddy-361946eb0c08791ad16ebc3e82a79512895e650f.zip
reverseproxy: weighted_round_robin load balancing policy (#5579)
* added weighted round robin algorithm to load balancer * added an adapt integration test for wrr and fixed a typo * changed args format to Caddyfile args convention * added provisioner and validator for wrr * simplified the code and improved doc
Diffstat (limited to 'caddytest')
-rw-r--r--caddytest/integration/caddyfile_adapt/reverse_proxy_load_balance_wrr.txt71
1 files changed, 71 insertions, 0 deletions
diff --git a/caddytest/integration/caddyfile_adapt/reverse_proxy_load_balance_wrr.txt b/caddytest/integration/caddyfile_adapt/reverse_proxy_load_balance_wrr.txt
new file mode 100644
index 000000000..d41c4b8bf
--- /dev/null
+++ b/caddytest/integration/caddyfile_adapt/reverse_proxy_load_balance_wrr.txt
@@ -0,0 +1,71 @@
+:8884
+
+reverse_proxy 127.0.0.1:65535 127.0.0.1:35535 {
+ lb_policy weighted_round_robin 10 1
+ lb_retries 5
+ lb_try_duration 10s
+ lb_try_interval 500ms
+ lb_retry_match {
+ path /foo*
+ method POST
+ }
+ lb_retry_match path /bar*
+}
+----------
+{
+ "apps": {
+ "http": {
+ "servers": {
+ "srv0": {
+ "listen": [
+ ":8884"
+ ],
+ "routes": [
+ {
+ "handle": [
+ {
+ "handler": "reverse_proxy",
+ "load_balancing": {
+ "retries": 5,
+ "retry_match": [
+ {
+ "method": [
+ "POST"
+ ],
+ "path": [
+ "/foo*"
+ ]
+ },
+ {
+ "path": [
+ "/bar*"
+ ]
+ }
+ ],
+ "selection_policy": {
+ "policy": "weighted_round_robin",
+ "weights": [
+ 10,
+ 1
+ ]
+ },
+ "try_duration": 10000000000,
+ "try_interval": 500000000
+ },
+ "upstreams": [
+ {
+ "dial": "127.0.0.1:65535"
+ },
+ {
+ "dial": "127.0.0.1:35535"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ }
+}