From c477565acb9dd551044a97e9c700802d290debe7 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 15 Mar 2017 18:06:16 -0500 Subject: [PATCH] Added Haproxy global tunables Max number of connection may be set up, as well as major tunables may be added as the variables. Change-Id: I5b333b79680d81b030810a7e94e3cc4bfe724649 --- defaults/main.yml | 14 ++++++++++++++ .../implement_tuning_params-e627c774c0d0c9d2.yaml | 7 +++++++ templates/haproxy.cfg.j2 | 13 +++++++++++-- 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/implement_tuning_params-e627c774c0d0c9d2.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 01001ea..97023df 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -73,3 +73,17 @@ haproxy_hatop_download_url: "https://storage.googleapis.com/google-code-archive- ## haproxy default timeouts haproxy_http_request_timeout: "5s" + +## haproxy tuning params +haproxy_maxconn: 4096 + +# Parameters below should only be specified if necessary, defaults are programmed in the template +#haproxy_tuning_params: +# nbproc: 1 +# bufsize: 384000 +# chksize: 16384 +# comp_maxlevel: 1 +# http_maxhdr: 101 +# http_maxaccept: 64 +# ssl_cachesize: 20000 +# ssl_lifetime: 300 diff --git a/releasenotes/notes/implement_tuning_params-e627c774c0d0c9d2.yaml b/releasenotes/notes/implement_tuning_params-e627c774c0d0c9d2.yaml new file mode 100644 index 0000000..e5c258a --- /dev/null +++ b/releasenotes/notes/implement_tuning_params-e627c774c0d0c9d2.yaml @@ -0,0 +1,7 @@ +--- +features: + - Haproxy-server role allows to set up tunable parameters. + For doing that it is necessary to set up a dictionary of options in the + config files, mentioning those which have to be changed (defaults for the + remaining ones are programmed in the template). Also "maxconn" global option + made to be tunable. diff --git a/templates/haproxy.cfg.j2 b/templates/haproxy.cfg.j2 index d184443..7566592 100644 --- a/templates/haproxy.cfg.j2 +++ b/templates/haproxy.cfg.j2 @@ -7,8 +7,17 @@ global user haproxy group haproxy daemon - maxconn 4096 - tune.bufsize 384000 + maxconn {{ haproxy_maxconn }} +{% if haproxy_tuning_params is defined %} + nbproc {{ haproxy_tuning_params.nbproc | default('1') }} + tune.bufsize {{ haproxy_tuning_params.bufsize | default('384000') }} + tune.chksize {{ haproxy_tuning_params.chksize | default('16384') }} + tune.comp.maxlevel {{ haproxy_tuning_params.comp_maxlevel | default('1') }} + tune.http.maxhdr {{ haproxy_tuning_params.http_maxhdr | default('101') }} + tune.http.maxaccept{{ haproxy_tuning_params.http_maxaccept | default('64') }} + tune.ssl.cachesize {{ haproxy_tuning_params.ssl_cachesize | default('20000') }} + tune.ssl.lifetime {{ haproxy_tuning_params.ssl_lifetime | default('300') }} +{% endif %} stats socket /var/run/haproxy.stat level admin mode 600 {% if haproxy_ssl | bool %} ssl-default-bind-options {{ haproxy_ssl_bind_options }}