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

You raised nofile in limits.conf but the service still has 1024. Why?

IntermediateProductionLogs, Limits & High-Traffic Tuning
Answer

/etc/security/limits.conf is applied by pam_limits to PAM login sessions (SSH, su, sudo). systemd services do not go through PAM, so they ignore it. Set the limit in the unit:

[Service]
LimitNOFILE=65536
sudo systemctl daemon-reload && sudo systemctl restart api
grep 'open files' /proc/$(systemctl show -p MainPID --value api)/limits

For a global default for all services, set DefaultLimitNOFILE= in /etc/systemd/system.conf.

All Linux questions Roadmap: Linux

More on Logs, Limits & High-Traffic Tuning