I've been getting java.io.IOException: Too many open files
while running a Kafka instance and using one topic with 1000 partitions so I started investigating the file descriptors limits in my ec2 vm. I cannot understand which is exactly the limit for open files on a Centos 7 machine since all the following commands produce different results. The commands are:
ulimit -a
: open files 1024lsof | wc -l
: 298280cat /proc/sys/fs/file-max
: 758881 (which is consistent with/proc/sys/fs/file-nr
)
If the actual limit is the one the last command produces then I am well below it (lsof | wc -l
: 298280). But if this is the case, the output of the ulimit
command is quite unclear to me since I am well above the 1024 open files.
According to the official documentation the best way to check for file descriptors in Centos is the /proc/sys/fs/file-max
file but are there all these seemingly "inconsistencies" between these commands?
ulimit -aH
? – schily Oct 18 '18 at 15:15cat /proc/sys/fs/file-nr
I get6112 0 758881
. Which according to this indicates a total of 6112 allocated file descriptors (none of them are free - second number is zero). So if 4096 is the hard limit I am well above it and Kafka should have failed but it's still running. So how can this be the hard limit? And why thelsof
output is that huge? – Niko Oct 18 '18 at 15:27