File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ The proxy is configured via environment variables.
31
31
* ` CONCURRENCY ` — The number of concurrent requests to allow through to
32
32
gunicorn. It's recommended to set this equal to the number of gunicorn
33
33
workers.
34
+ * ` MAX_CONNECTIONS ` — The number of simultaneous connections HAProxy will
35
+ accept. Defaults to 2000.
34
36
* ` SYSLOG_SERVER ` — A syslog server to output logs to. Defaults to
35
37
` localhost ` .
36
38
* ` QUEUE_TIMEOUT ` — How long requests will wait for a gunicorn worker before
@@ -53,12 +55,16 @@ The proxy will queue requests and return a 503 if they've queued too long.
53
55
This load shedding allows the server to continue to serve some requests within
54
56
a reasonable time during periods of excessive load.
55
57
56
- ## Healthchecks
57
-
58
58
Requests matching ` HEALTHCHECK_PATH ` skip the queue. This allows healthchecks
59
59
to continue succeeding even when the proxy is load shedding, as long as
60
60
gunicorn is still processing requests.
61
61
62
+ ` MAX_CONNECTIONS ` should be set to a number greater than ` QUEUE_TIMEOUT `
63
+ multiplied by the maximum number requests per second your application can
64
+ serve. Otherwise HAProxy may start rejecting new connections before the queue
65
+ fills up, negating the benefits of having one. ` MAX_CONNECTIONS ` defaults to
66
+ 2000, which should be great enough for most applications.
67
+
62
68
## Logging
63
69
64
70
Technically ` SYSLOG_SERVER ` is not required, as by default logs will be routed
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ compression type text/html text/plain application/json
21
21
cat << EOF > /usr/local/etc/haproxy/haproxy.cfg
22
22
23
23
global
24
- maxconn 256
24
+ maxconn ${MAX_CONNECTIONS :- 2000}
25
25
26
26
defaults
27
27
mode http
You can’t perform that action at this time.
0 commit comments