-
Notifications
You must be signed in to change notification settings - Fork 0
/
haproxy.cfg
33 lines (29 loc) · 815 Bytes
/
haproxy.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This haproxy.cfg demonstrates how to use the cpu-agent in conjunction
# with agent checks to manage weighting.
#
# Run the following:
#
# A local web server of some sort, `sudo apachectl start` on MacOS,
# for example.
#
# Start the cpu-agent on the same host:
# `docker run --rm -it -p 40000:40000 --pid=host aasmith/cpu-agent`
#
# Start haproxy using this config: `haproxy -f haproxy.cfg`
#
# If your local CPU isn't choppy enough, consider this as a test:
# `ncat -vl -p 40000 -kc 'echo $(( ( RANDOM % 100 ) + 1 ))%'`
#
# Load up the haproxy stats page, and observe weighting fluctuations.
#
global
maxconn 300
listen foo
mode http
bind :8000
server srv-a 127.0.0.1:80 check agent-check agent-port 40000 weight 100
listen stats
mode http
stats enable
stats refresh 2s
bind :8001