Skip to content

Commit

Permalink
Default LB Policy to Least Request
Browse files Browse the repository at this point in the history
https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers#weighted-least-request

Relates to envoyproxy#1105

Relevant now that we are introducing multiple endpoints with envoyproxy#1494

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg committed Sep 19, 2023
1 parent b98c1d1 commit b8bdf77
Show file tree
Hide file tree
Showing 55 changed files with 117 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
},
"serviceName": "httproute/envoy-gateway-system/backend/rule/0"
},
"lbPolicy": "LEAST_REQUEST",
"name": "httproute/envoy-gateway-system/backend/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
Expand All @@ -246,6 +247,7 @@
"connectTimeout": "10s",
"dnsLookupFamily": "V4_ONLY",
"dnsRefreshRate": "30s",
"lbPolicy": "LEAST_REQUEST",
"loadAssignment": {
"clusterName": "raw_githubusercontent_com_443",
"endpoints": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/envoy-gateway-system/backend/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -142,6 +143,7 @@ xds:
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: raw_githubusercontent_com_443
endpoints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/envoy-gateway-system/backend/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -24,6 +25,7 @@ xds:
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: raw_githubusercontent_com_443
endpoints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/default/backend/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -624,6 +625,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: grpcroute/default/backend/rule/0
lbPolicy: LEAST_REQUEST
name: grpcroute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -644,6 +646,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: tlsroute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: tlsroute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -659,6 +662,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: tcproute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: tcproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -674,6 +678,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: udproute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: udproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/envoy-gateway-system/backend/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
},
"serviceName": "httproute/default/backend/rule/0"
},
"lbPolicy": "LEAST_REQUEST",
"name": "httproute/default/backend/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
Expand All @@ -350,6 +351,7 @@
},
"serviceName": "grpcroute/default/backend/rule/0"
},
"lbPolicy": "LEAST_REQUEST",
"name": "grpcroute/default/backend/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
Expand Down Expand Up @@ -379,6 +381,7 @@
},
"serviceName": "tlsroute/default/backend/rule/-1"
},
"lbPolicy": "LEAST_REQUEST",
"name": "tlsroute/default/backend/rule/-1",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
Expand All @@ -400,6 +403,7 @@
},
"serviceName": "tcproute/default/backend/rule/-1"
},
"lbPolicy": "LEAST_REQUEST",
"name": "tcproute/default/backend/rule/-1",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
Expand All @@ -421,6 +425,7 @@
},
"serviceName": "udproute/default/backend/rule/-1"
},
"lbPolicy": "LEAST_REQUEST",
"name": "udproute/default/backend/rule/-1",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/default/backend/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -196,6 +197,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: grpcroute/default/backend/rule/0
lbPolicy: LEAST_REQUEST
name: grpcroute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -216,6 +218,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: tlsroute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: tlsroute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -231,6 +234,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: tcproute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: tcproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -246,6 +250,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: udproute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: udproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/default/backend/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -28,6 +29,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: grpcroute/default/backend/rule/0
lbPolicy: LEAST_REQUEST
name: grpcroute/default/backend/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -48,6 +50,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: tlsroute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: tlsroute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -63,6 +66,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: tcproute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: tcproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -78,6 +82,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: udproute/default/backend/rule/-1
lbPolicy: LEAST_REQUEST
name: udproute/default/backend/rule/-1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
},
"serviceName": "httproute/envoy-gateway-system/http-ratelimit/rule/0"
},
"lbPolicy": "LEAST_REQUEST",
"name": "httproute/envoy-gateway-system/http-ratelimit/rule/0",
"outlierDetection": {},
"perConnectionBufferLimitBytes": 32768,
Expand All @@ -246,6 +247,7 @@
"connectTimeout": "10s",
"dnsLookupFamily": "V4_ONLY",
"dnsRefreshRate": "30s",
"lbPolicy": "LEAST_REQUEST",
"loadAssignment": {
"clusterName": "ratelimit_cluster",
"endpoints": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/envoy-gateway-system/http-ratelimit/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/http-ratelimit/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -142,6 +143,7 @@ xds:
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: ratelimit_cluster
endpoints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ xds:
ads: {}
resourceApiVersion: V3
serviceName: httproute/envoy-gateway-system/http-ratelimit/rule/0
lbPolicy: LEAST_REQUEST
name: httproute/envoy-gateway-system/http-ratelimit/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -24,6 +25,7 @@ xds:
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: ratelimit_cluster
endpoints:
Expand Down
2 changes: 1 addition & 1 deletion internal/xds/translator/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func buildXdsCluster(clusterName string, tSocket *corev3.TransportSocket, protoc
cluster := &clusterv3.Cluster{
Name: clusterName,
ConnectTimeout: durationpb.New(10 * time.Second),
LbPolicy: clusterv3.Cluster_ROUND_ROBIN,
LbPolicy: clusterv3.Cluster_LEAST_REQUEST,
DnsLookupFamily: clusterv3.Cluster_V4_ONLY,
CommonLbConfig: &clusterv3.Cluster_CommonLbConfig{
LocalityConfigSpecifier: &clusterv3.Cluster_CommonLbConfig_LocalityWeightedLbConfig_{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ads: {}
resourceApiVersion: V3
serviceName: first-route-dest
lbPolicy: LEAST_REQUEST
name: first-route-dest
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ads: {}
resourceApiVersion: V3
serviceName: first-route-dest
lbPolicy: LEAST_REQUEST
name: first-route-dest
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ads: {}
resourceApiVersion: V3
serviceName: direct-route-dest
lbPolicy: LEAST_REQUEST
name: direct-route-dest
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -16,6 +17,7 @@
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: accesslog|otel-collector.default.svc.cluster.local|4317
endpoints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ads: {}
resourceApiVersion: V3
serviceName: first-route-www.test.com-dest
lbPolicy: LEAST_REQUEST
name: first-route-www.test.com-dest
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -20,6 +21,7 @@
ads: {}
resourceApiVersion: V3
serviceName: second-route-www.test.com-dest
lbPolicy: LEAST_REQUEST
name: second-route-www.test.com-dest
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -29,6 +31,7 @@
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: localhost_443
endpoints:
Expand Down Expand Up @@ -62,6 +65,7 @@
ads: {}
resourceApiVersion: V3
serviceName: "192_168_1_250_8080"
lbPolicy: LEAST_REQUEST
name: "192_168_1_250_8080"
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ads: {}
resourceApiVersion: V3
serviceName: first-route-dest
lbPolicy: LEAST_REQUEST
name: first-route-dest
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -20,6 +21,7 @@
ads: {}
resourceApiVersion: V3
serviceName: second-route-dest
lbPolicy: LEAST_REQUEST
name: second-route-dest
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
Expand All @@ -29,6 +31,7 @@
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: localhost_443
endpoints:
Expand Down
Loading

0 comments on commit b8bdf77

Please sign in to comment.