worker_rlimit_nofile is for total of all worker processes or single worker process?

fengx nginx-forum at forum.nginx.org
Mon May 15 15:18:15 UTC 2017


I read through the source codes and find the limit should be applied to each
worker process. Right ?

static void
ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker)
{
    // .....

    if (ccf->rlimit_nofile != NGX_CONF_UNSET) {
        rlmt.rlim_cur = (rlim_t) ccf->rlimit_nofile;
        rlmt.rlim_max = (rlim_t) ccf->rlimit_nofile;

        if (setrlimit(RLIMIT_NOFILE, &rlmt) == -1) {
            ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
                          "setrlimit(RLIMIT_NOFILE, %i) failed",
                          ccf->rlimit_nofile);
        }
    }

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,274218,274227#msg-274227



More information about the nginx mailing list