#
# SPDX-License-Identifier: AGPL-3.0
+{%- set max_reqs = "__CONTROLLER_MAX_CONCURRENT_REQUESTS__" %}
+
# The variables commented out are the default values that the formula uses.
# The uncommented values are REQUIRED values. If you don't set them, running
# this formula will fail.
Password: __INITIAL_USER_PASSWORD__
### API
- {%- set max_reqs = "__CONTROLLER_MAX_CONCURRENT_REQUESTS__" %}
- {%- if max_reqs != "" and max_reqs is number %}
+ {%- if max_reqs != "" %}
API:
- MaxConcurrentRequests: {{ max_reqs }}
+ MaxConcurrentRequests: {{ max_reqs|int }}
{%- endif %}
### CONTAINERS
{%- import_yaml "ssl_key_encrypted.sls" as ssl_key_encrypted_pillar %}
{%- set domain = "__DOMAIN__" %}
{%- set balancer_backends = "__CONTROLLER_NODES__".split(",") %}
+{%- set controller_nr = balancer_backends|length %}
{%- set disabled_controller = "__DISABLED_CONTROLLER__" %}
+{%- if disabled_controller != "" %}
+ {%- set controller_nr = controller_nr - 1 %}
+{%- endif %}
+{%- set max_reqs = "__CONTROLLER_MAX_CONCURRENT_REQUESTS__" %}
### NGINX
nginx:
### SERVER
server:
config:
+ {%- if max_reqs != "" %}
+ worker_rlimit_nofile: {{ (max_reqs|int * 3 * controller_nr)|round|int }}
+ events:
+ worker_connections: {{ (max_reqs|int * 3 * controller_nr)|round|int }}
+ {%- else %}
+ worker_rlimit_nofile: 4096
+ events:
+ worker_connections: 1024
+ {%- endif %}
### STREAMS
http:
'geo $external_client':
# Performance tuning parameters
#CONTROLLER_NGINX_WORKERS=
-#CONTROLLER_MAX_CONCURRENT_REQUESTS=
+CONTROLLER_MAX_CONCURRENT_REQUESTS=64
# The directory to check for the config files (pillars, states) you want to use.
# There are a few examples under 'config_examples'.
s#__SSL_KEY_AWS_REGION__#${SSL_KEY_AWS_REGION}#g;
s#__SSL_KEY_AWS_SECRET_NAME__#${SSL_KEY_AWS_SECRET_NAME}#g;
s#__CONTROLLER_NGINX_WORKERS__#${CONTROLLER_NGINX_WORKERS:-}#g;
- s#__CONTROLLER_MAX_CONCURRENT_REQUESTS__#${CONTROLLER_MAX_CONCURRENT_REQUESTS:-}#g;
+ s#__CONTROLLER_MAX_CONCURRENT_REQUESTS__#${CONTROLLER_MAX_CONCURRENT_REQUESTS:-64}#g;
s#__MONITORING_USERNAME__#${MONITORING_USERNAME}#g;
s#__MONITORING_EMAIL__#${MONITORING_EMAIL}#g;
s#__MONITORING_PASSWORD__#${MONITORING_PASSWORD}#g;