Least Connections
Routes each request to the backend with the fewest in-flight requests
Category: Practical
Task: Routes each request to the backend with the fewest in-flight requests
Prerequisites: The product runtime and any backend services referenced by this configuration.
This configuration comes from the selected release. The example has not been run here; external services are not bundled.
Download the source file.
# Least-Connections Load Balancing
#
# Routes each request to the backend with the fewest in-flight
# requests. Useful when request cost or latency varies.
#
# Usage:
# cargo run -p praxis-proxy -- -c examples/configs/traffic-management/least-connections.yaml
# curl http://localhost:8080/ &
# curl http://localhost:8080/ &
# curl http://localhost:8080/ &
# wait
listeners:
- name: default
address: "127.0.0.1:8080"
filter_chains:
- main
filter_chains:
- name: main
filters:
- filter: router
routes:
- path_prefix: "/"
cluster: backend
- filter: load_balancer
clusters:
- name: backend
load_balancer_strategy: least_connections
endpoints:
- "127.0.0.1:3001"
- "127.0.0.1:3002"
- "127.0.0.1:3003"
insecure_options:
allow_private_endpoints: true # example proxies to local backends