Work out open file limit instantly with clear inputs, formula shown and shareable results.
There are two separate limits: fs.file-max caps descriptors system-wide, and the nofile rlimit caps them per process. Hitting the system limit returns ENFILE and affects every process; hitting the per-process limit returns EMFILE and affects only one. Each open descriptor also costs kernel memory, so a very high limit has a real cost when actually used.
Descriptor accounting
total = processes x descriptors per process; kernel memory = total x bytes per descriptor; compare against fs.file-max
EMFILE means the process hit its own nofile rlimit; ENFILE means the system-wide fs.file-max is exhausted. They need different fixes.
Compare /proc/PID/fd counts across processes, or use lsof grouped by process. A steadily growing count with no corresponding workload growth is a leak.