I've found a number of articles describing how to increase the limits for the number of open files through /etc/security/limits.conf, but I don't understand the impact of doing so. Many times I see people updating 1024 to 2048. Ok, those file handles must cost RAM or something. Why not increase it to 100000? What resource am I eating up with open files?

A question about how to increase the limits: https://stackoverflow.com/questions/34588/how-do-i-change-the-number-of-open-files-limit-in-linux


This is the limit on the number of files that a single process can have open at a time. Sockets, pipes, and terminals count too. There is almost no software in existence that can handle more than about 20,000 files open at a time, so there's no point in setting the limit higher than that.

  • 1
    Excellent, thanks. I understood that these were limits, and I guess I was wondering what they were protecting against. We have a server hosting some very active apps that is pushing the 16k limit, so I wanted to check what would be the impact if we just let it continue to expand. I'll turn my attention to why we have so many darn files then. Thanks again.
    – Adam
    Feb 21 '14 at 19:34
  • @Adam If the number is growing because they're legitimately using more network connections or files, then you can keep raising it, at least until you hit the limit of what the software can handle. But if it's a file descriptor leak, that should be investigated and fixed. Feb 21 '14 at 19:51
  • 3
    Update from the future, Nexus 3 now has a check and complains if you have less than 64k.
    – Adam
    Sep 19 '17 at 21:16
  • 3
    Note that some heavy-IO processes like Kafka may require more than that. For example, typical nofile max values are recommended above 100,000
    – xmar
    Aug 7 '18 at 16:00
  • 3
    The 20K number is seriously out of date now. :) Aug 8 '18 at 0:44

Just like to add that value of nofiles depend on "/proc/sys/fs/nr_open" as mentioned above and ulimit uses setrlimit() to set resource limit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.