Maximum number of file descriptors

Hi

I’m using nginx for long polling requests.
Each user will have at least one hanging request in addition to
requesting
static files when needed.
I understand that each connection needs a file descriptor.
The default limit on ubuntu is 1024.
How can I increase this limit?
Do I need to change something on ubuntu or just in nginx config?
Does worker_rlimit_nofile what I’m looking for or does it only set the
limit
per worker and I’ll still hit the master process limit?
http://wiki.nginx.org/NginxHttpMainModule#worker_rlimit_nofile

Thanks

Hi

On Tue, Sep 28, 2010 at 23:06, pablo platt [email protected]
wrote:

The default limit on ubuntu is 1024.
How can I increase this limit?

That’s not nginx-specific, maybe you wanna ask in the ubuntu forums
(or, better, Debian)?
Or, better yet, try a search engine first:

HTH,
Nuno

2010/9/29 Nuno Magalhães [email protected]

If you’ll read my question you’ll see that it is related to nginx.
lmgtfy was funny years ago. The fact that you are still using it is a
bit
sad.

If someone else can answer my question I’ll appreciate it.

Hi,

The default limit on ubuntu is 1024.
How can I increase this limit?

That’s not nginx-specific, maybe you wanna ask in the ubuntu forums
(or, better, Debian)?

Actually, it is:
worker_rlimit_nofile XXXX;

Best regards,
Piotr S. < [email protected] >

Hi,

Igor said that worker_rlimit_nofile is not enough:
How to get nginx to see higher limit for file descriptors?

It works for me just fine.

Best regards,
Piotr S. < [email protected] >

On Wed, Sep 29, 2010 at 00:27, Piotr S. [email protected]
wrote:

Hi,

The default limit on ubuntu is 1024.
How can I increase this limit?

That’s not nginx-specific, maybe you wanna ask in the ubuntu forums
(or, better, Debian)?

Actually, it is:
worker_rlimit_nofile XXXX;

If you set worker_rlimit_nofile XXXX to 2048 you’re still gonna hit
that 1024 system limit (assuming Ubuntu) and this directive is only
for worker processes, not the master process (according to a link the
OP provided, quoting Igor).

The first link on the search i provided points to how to increase the
system limit for specific users (like www and similar, used by the OS
to run the httpd).

Regards,
Nuno

On Wed, Sep 29, 2010 at 1:27 AM, Piotr S.
[email protected]wrote:

Actually, it is:
worker_rlimit_nofile XXXX;

Best regards,
Piotr S. < [email protected] >

Igor said that worker_rlimit_nofile is not enough:
http://nginx.org/pipermail/nginx/2008-April/004596.html

On Sep 29, Piotr S. wrote:

Igor said that worker_rlimit_nofile is not enough:
How to get nginx to see higher limit for file descriptors?

It works for me just fine.

It works as long as your master process is running as root. Given that
nginx is usually listening on port 80, the master process is usually
running as root.

My pratical observation is that the limits seem to be set before the
workers are forked and hence, the elevated limits seem to be carried
forward.

limits.conf is applicable for user-sessions. A program started directly
by init is unaffected by these settings.

Note that all the statements above are for linux. I am not sure how it
works on FreeBSD.