This article helps you to find out information about file descriptors used by the system.
Prerequisite:
An exception as “Too many files open”
is observed in your hivemq.log
and max open file limit is already set as “1000000
“ files.
Instructions
Step 1:
There are two ways to get a current an open and max file descriptor(FD) count.
Enable monitoring with HiveMQ Promothus extension. The highly-performant metrics subsystem of HiveMQ lets you monitor relevant metrics with no reduction in system performance (even in low-latency high-throughput environments).
In the context of this article you can check following matrics:com.hivemq.system.open-file-descriptor
com.hivemq.system.max-file-descriptor
These metrics provide counts of currently open file descriptors and max file descriptors.Also, as an alternative, you can use the below commands from your shell to get the requested metrics
The following command displays the soft limit, hard limit, and units of measurement for each of the process's resource limits. From that list, you can get details about
Max open files
$ cat /proc/1/limits
The following command can be used to know how many file descriptors are being used
$ cat /proc/sys/fs/file-nr
You can interpret the file content as
column 1 = total allocated file descriptors (the number of file descriptors allocated since boot)
column 2 = total free allocated file descriptors
column 3 = maximum open file descriptors$ ulimit
to know the number of open file descriptors per process
Step 2
Please execute the following steps to get the list of open files.
Install
lsof
if it’s not available already else skip this step$ apt update && apt install lsof
switch to hivemq user (UID of the process)
$ su hivemq
show all open files
$ lsof -p 1 > open_files.txt
Share created open_files.txt
with HiveMQ support to investigate further.