From 48231e1df07615763b40375cbdc58134e2bd837a Mon Sep 17 00:00:00 2001 From: Jorge Niedbalski Date: Tue, 8 May 2018 23:53:41 -0300 Subject: [PATCH] [haproxy] Enable global optimization options This patch enables 3 new configuration options for haproxy.cfg global section. - haproxy_processes: number of haproxy processes (default:1). - haproxy_max_connections: number of concurrent connections (default:4000) - haproxy_process_cpu_map: enforces 1:1 mapping/affinity between process and core. (default: no). Closes-Bug: #1770060 Change-Id: I33fc499b083c7bcc548133498e44406a479389f1 Signed-off-by: Jorge Niedbalski --- ansible/roles/haproxy/defaults/main.yml | 5 +++++ ansible/roles/haproxy/templates/haproxy.cfg.j2 | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ansible/roles/haproxy/defaults/main.yml b/ansible/roles/haproxy/defaults/main.yml index 06277ef19e..8773b984cb 100644 --- a/ansible/roles/haproxy/defaults/main.yml +++ b/ansible/roles/haproxy/defaults/main.yml @@ -50,3 +50,8 @@ keepalived_traffic_mode: "multicast" haproxy_listen_tcp_extra: [] haproxy_listen_http_extra: [] + +# Extended global configuration, optimization options. +haproxy_max_connections: 4000 +haproxy_processes: 1 +haproxy_process_cpu_map: "no" diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2 index dbeea9da72..514c86ef3d 100644 --- a/ansible/roles/haproxy/templates/haproxy.cfg.j2 +++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -6,7 +6,13 @@ global group haproxy daemon log {{ syslog_server }}:{{ syslog_udp_port }} {{ syslog_haproxy_facility }} - maxconn 4000 + maxconn {{ haproxy_max_connections }} + nbproc {{ haproxy_processes }} +{% if haproxy_processes > 1 and haproxy_process_cpu_map | bool %} +{% for cpu_idx in range(0, haproxy_processes) %} + cpu-map {{cpu_idx+1}} {{cpu_idx}} +{% endfor %} +{% endif %} stats socket /var/lib/kolla/haproxy/haproxy.sock group kolla mode 660 {% if kolla_enable_tls_external | bool %} ssl-default-bind-ciphers DEFAULT:!MEDIUM:!3DES