LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-18-2016, 06:08 AM   #1
hilou
Member
 
Registered: May 2013
Posts: 93

Rep: Reputation: Disabled
how to increase the max open files of nginx master process


Hi All,

I know there is a config called: worker_rlimit_nofile which could change the max open files of nginx worker, but how to increase the master's ?

# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 773092
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65535
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 773092
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

nginx version:
/usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.4.4

OS:
14.04.3 LTS, Trusty Tahr

worker config:
worker_rlimit_nofile 20480;

/proc/8389/limits:
Max open files 1024 4096 files

8389 is the master process id.

Nginx is not managed by Systemd, systemV instead.

Thank you in advance
 
Old 09-18-2016, 09:48 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You really don't need to.

The task the master is doing is to receive connection requests - and then pass the connection to a worker.

The normal number of requests will be 0, and 1 when a connection request comes in. It only takes a few microseconds to pass that connection to a worker. The only other files open would be stdout/stderr and those would be redirected to a log file.

Additional requests will be queued for processing - but the master process can only handle one at a time.

The purpose for having many simultaneous connections for a worker is via multi-threading. There can be MANY threads active - but there would be only one connection to the client - and only a few more used to access data. The aggregate for the workers could be a large number (assuming multi-threaded). If each thread is an independent process, then having a huge number of open files would be a bit of a waste.

The general reason for 1024 open files as a limit is that it is also the limit of file descriptors the select system call can support. Epoll can handle more - but usualy the only thing that needs that many files open at a time would be a database server, not a web server.

Last edited by jpollard; 09-18-2016 at 09:49 AM.
 
2 members found this post helpful.
Old 09-19-2016, 03:45 AM   #3
hilou
Member
 
Registered: May 2013
Posts: 93

Original Poster
Rep: Reputation: Disabled
@ Jpllard

Thank you for your comment. But I actually configured my nginx to use epoll, so I just want to know why the max open files is still 1024 and how could I increase it.

Thanks
 
  


Reply

Tags
nginx


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can process pid cross max file open limit? gaurav_s Linux - Software 2 06-05-2015 09:13 AM
Max Open Files issue dodg3r7 Linux - Server 2 04-27-2015 10:10 AM
Why can not increase the open files (fds) ? chachi95 Linux - Newbie 2 09-26-2011 11:33 AM
max open files ruleman Linux - General 2 08-31-2004 04:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration