Forum: NGINX worker_connections and worker_rlimit_nofile

Posted by Max (Guest)
on 2010-02-04 09:50
(Received via mailing list)
Hello,

I used to use worker_connections but wen I use it, I got a lot of too 
many
open files in the error log.

Now, I changed it to worker_rlimit_nofile 10240 and the problem has been
solved (I google it and found the solution).

I just want to ask, what's the differences between worker_connections 
and
worker_rlimit_nofile? Why worker_connections will casue too many open 
files
problem? Thanks.

#user  nobody;
worker_processes  2;
worker_rlimit_nofile 10240;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
#    worker_connections  10240;
}

Max
Posted by Arvind Jayaprakash (Guest)
on 2010-03-01 11:04
(Received via mailing list)
On Feb 04, Max wrote:
>I used to use worker_connections but wen I use it, I got a lot of too many
>open files in the error log.
>
>Now, I changed it to worker_rlimit_nofile 10240 and the problem has been
>solved (I google it and found the solution).
>
>I just want to ask, what's the differences between worker_connections and
>worker_rlimit_nofile? Why worker_connections will casue too many open files
>problem? Thanks.

worker_connections specifies how many network connections a worker is
allowed to maintain. worker_rlimit_nofile specifies how many open file
handles are allowed per worker. Since all tcp connections are file
handles (descriptors) on *nix systems, worker_rlimit_nofile must be
greater than worker_connections.
Posted by Maxim Dounin (Guest)
on 2010-03-01 11:56
(Received via mailing list)
Hello!

On Mon, Mar 01, 2010 at 03:34:03PM +0530, Arvind Jayaprakash wrote:

> 
> worker_connections specifies how many network connections a worker is
> allowed to maintain. worker_rlimit_nofile specifies how many open file
> handles are allowed per worker. Since all tcp connections are file
> handles (descriptors) on *nix systems, worker_rlimit_nofile must be
> greater than worker_connections.

Not really.  Directive worker_rlimit_nofile doesn't specify
"how many", it is operation system limit which does.  Directive
worker_rlimit_nofile just allows an quick-and-dirty way to enlarge
this limit if it's not enough.

Maxim Dounin
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.