sysctl.si › Parameters › fs.file-max

fs.file-max

System-wide limit on open files.

Default
varies
Typical value
524288 or more on busy servers

When to change it

Raise it for servers with many sockets or open files. Per-process limits such as ulimit and systemd LimitNOFILE must be raised as well.

Check the current value

sysctl fs.file-max

Change it until the next reboot

sudo sysctl -w fs.file-max=524288

Make it permanent

echo "fs.file-max = 524288" | sudo tee /etc/sysctl.d/99-custom.conf
sudo sysctl --system

Related parameters

fs.inotify.max_user_watches · fs.inotify.max_user_instances

Generate a full sysctl config for your server

Values are starting points. Test on a staging machine and measure before and after.