# Worker\_connections and worker\_rlimit\_nofile

**URL:** <https://www.ruby-forum.com/t/worker-connections-and-worker-rlimit-nofile/182882>\
**Category:** NGINX\
**Created:** [February 4, 2010, 9:50am UTC](https://www.ruby-forum.com/t/worker-connections-and-worker-rlimit-nofile/182882 "2010-02-04T09:50:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![max](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@max](https://www.ruby-forum.com/u/max)\
**Post date:** [February 4, 2010, 9:50am UTC](https://www.ruby-forum.com/t/worker-connections-and-worker-rlimit-nofile/182882/1 "2010-02-04T09:50:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![max](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@max](https://www.ruby-forum.com/u/max)\
**Post date:** [March 1, 2010, 11:04am UTC](https://www.ruby-forum.com/t/worker-connections-and-worker-rlimit-nofile/182882/2 "2010-03-01T11:04:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![max](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@max](https://www.ruby-forum.com/u/max)\
**Post date:** [March 1, 2010, 11:56am UTC](https://www.ruby-forum.com/t/worker-connections-and-worker-rlimit-nofile/182882/3 "2010-03-01T11:56:20Z")

</div>

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 D.
