Quantcast

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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

AjaySawant
Hello

I'm confused if the worker_rlimit_nofile directive is for total of all
worker processes or single worker process? As I know, the worker_connections
is for single worker process. Let's say if I have two worker processes and
have worker_connections 512, then should I set worker_rlimit_nofile to 512
or 1024?

Thanks
Xiaofeng

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

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

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

AjaySawant
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

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...