How do ulimit -n and /proc/sys/fs/file-max differ?

Posted by bantic on Server Fault See other posts from Server Fault or by bantic
Published on 2010-03-15T16:48:08Z Indexed on 2010/03/15 16:50 UTC
Read the original article Hit count: 247

Filed under:

I notice that on a new CentOS image that I just booted up off of EC2 that the ulimit default is 1024 open files, but /proc/sys/fs/file-max is set at 761,408 and I'm wondering how these two limits work together. I'm guessing that ulimit -n is a per-user limit of number of file descriptors while /proc/sys/fs/file-max is system-wide? If that's the case, say I've logged in twice as the same user -- does each logged-in user have a 1024 limit on number of open files, or is it a limit of 1024 combined open files between each of those logged-in users?

And is there much performance impact to setting your max file descriptors to a very high number, if your system isn't ever opening very many files?

© Server Fault or respective owner

Related posts about ulimit