Interview Prep/Linux/Logs, Limits & High-Traffic Tuning

What are file descriptor limits, and where are they set?

BeginnerProductionLogs, Limits & High-Traffic Tuning
Answer

Each process can open only so many files and sockets. There is a per-process soft and hard limit (RLIMIT_NOFILE) and a system-wide maximum.

ulimit -n; ulimit -Hn                 # current shell soft/hard
cat /proc/<pid>/limits | grep 'open files'
cat /proc/sys/fs/file-max             # system-wide max
cat /proc/sys/fs/file-nr              # allocated, unused, max

Hitting the limit gives EMFILE: Too many open files.

All Linux questions Roadmap: Linux

More on Logs, Limits & High-Traffic Tuning