Skip to content

Latest commit

 

History

History

vanilla_weighted_load_balancer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Weighted Load Balancing

docker-compose build
docker-compose up --force-recreate

Weighting configuration

    # Weighted load balancing example
    - match:
        prefix: "/version"
    route:
        weighted_clusters:
        clusters:
        - name: cluster_version_1
            weight: 10
        - name: cluster_version_2
            weight: 90
    # ----

Balance testing

while true; do curl localhost:8080/version; echo; sleep 1;  done


{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":1,"node_version":"8.6.0"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}
{"version":1,"node_version":"8.6.0"}
{"version":2,"node_version":"12.8.1"}
{"version":2,"node_version":"12.8.1"}