21285: Fixes worker & nofile calculations on nginx config.
[arvados.git] / tools / salt-install / config_examples / multi_host / aws / pillars / nginx_passenger.sls
index 82f1b91bb5ba4efb997f9f7da2c14b4a58f13e81..0c9ef1c36e6ff8629ac5b14158fb4b9d6fa57da4 100644 (file)
@@ -15,6 +15,7 @@
 {%- set _workers = ("__CONTROLLER_MAX_WORKERS__" or grains['num_cpus']*2)|int %}
 {%- set max_workers = [_workers, 8]|max %}
 {%- set max_reqs = ("__CONTROLLER_MAX_QUEUED_REQUESTS__" or 128)|int %}
+{%- set max_tunnels = ("__CONTROLLER_MAX_GATEWAY_TUNNELS__" or 1000)|int %}
 
 ### NGINX
 nginx:
@@ -50,13 +51,14 @@ nginx:
       {% endif %}
       worker_processes: {{ max_workers }}
 
-      # each request is up to 3 connections (1 with client, 1 proxy to
+      # Each client request is up to 3 connections (1 with client, 1 proxy to
       # controller, then potentially 1 from controller back to
       # passenger).  Each connection consumes a file descriptor.
       # That's how we get these calculations
-      worker_rlimit_nofile: {{ max_reqs * 3 + 1 }}
+      # (we're multiplying by 5 instead to be on the safe side)
+      worker_rlimit_nofile: {{ (max_reqs + max_tunnels) * 5 + 1 }}
       events:
-        worker_connections: {{ max_reqs * 3 + 1 }}
+        worker_connections: {{ (max_reqs + max_tunnels) * 5 + 1 }}
 
   ### SITES
   servers: