How to increase file descriptors max limit on Linux

9:02:00 AM 0 Comments

The walk through,

1. Find out what the current open file descriptor limit is.

~# more /proc/sys/fs/file-max  ~# 8192 

or

~# sysctl -a | grep fs.file-max  ~# fs.file-max = 8192

2. View how many open file descriptors are currently being used.

~# more /proc/sys/fs/file-nr  ~# 8191

3. View how many files are open. The number returned might defer as 1 file descriptor can have multiple open files attached to it.

~# lsof | wc -l  ~# 10325

4. Edit the kernel paramneter file /etc/sysctl.conf and add line "fs.file-max=[new value]" to it.

~# vi /etc/sysctl.conf  fs.file-max = 331287

5. Apply the changes.

~# sysctl -p ~# fs.file-max = 331287


To Count Total File Descriptors Used By Confluence

To get the total number of handles that are used by Confluence:

  1. Locate the Confluence ProcId by identifying the Java process with{{'ps axwwwu | grep java'}}
  2. Either run ls -la /proc/<pid>/fd, or use the lsof (LiSt Open Files) command lsof -p <pid of Confluence process>. For a Confluence ProcID of 460, use:
    $ lsof -p 460 | wc -l



 

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard.