[RFC] Core: worker_processes <= NGX_MAX_PROCESSES

Peter Stadler peter.stadler at student.uibk.ac.at
Tue May 12 10:04:58 UTC 2020


Would it be advisable to limit the number of worker_processes to 
NGX_MAX_PROCESSES at least when we have `worker_processes auto;` in the 
config?

A corresponding patch could be:

diff a/src/core/nginx.c b/src/core/nginx.c
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -1478,7 +1478,7 @@ ngx_set_worker_processes(ngx_conf_t *cf, 
ngx_command_t *cmd, void *conf)
      value = cf->args->elts;

      if (ngx_strcmp(value[1].data, "auto") == 0) {
-        ccf->worker_processes = ngx_ncpu;
+        ccf->worker_processes = ngx_min(ngx_ncpu, NGX_MAX_PROCESSES);
          return NGX_CONF_OK;
      }





More information about the nginx-devel mailing list