Weighted Load Balancing

Traffic split proportional to per-endpoint weights

Category: Practical
Task: Distribute requests across weighted backends

Prerequisites: Praxis runtime; At least two reachable HTTP backends

Expected outcome: Requests are distributed across endpoints according to their configured weights.

Run it: Use ghcr.io/praxis-proxy/praxis:0.7.2 and follow the first reverse-proxy tutorial to mount and start the configuration.

This configuration comes from the selected release. The example has not been run here; external services are not bundled.

Download the source file.

# Weighted Load Balancing
#
# Traffic split proportional to per-endpoint weights. Weights are
# relative integers — (1, 3) and (2, 6) produce the same distribution.
# Useful for canary rollouts and heterogeneous hardware.
#
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: round_robin
            endpoints:
              - address: "127.0.0.1:3001"
                weight: 1          # receives 1/4 of requests
              - address: "127.0.0.1:3002"
                weight: 3          # receives 3/4 of requests

insecure_options:
  allow_private_endpoints: true # example proxies to local backends