Calculate recommended ulimit values for file descriptors, processes and memory.
Every socket, log file and temp file a server opens consumes one file descriptor, so a high-concurrency service can exhaust the default 1024 ulimit -n very quickly. The raw requirement multiplies expected concurrent connections by the average files/sockets each one opens, and a safety factor is applied on top to absorb bursts, slow-closing connections and auxiliary file handles that are easy to undercount.
Recommended ulimit
recommended = connections × files_per_connection × safety_factor
Most distributions default the soft limit to 1024 file descriptors per process, which is far too low for high-concurrency servers like web servers, databases or message brokers handling thousands of simultaneous connections.
A factor of 1.5-2x over the raw calculated need is common, providing headroom for connection spikes, slow-closing sockets (TIME_WAIT), and file handles opened for logging or temporary files that are easy to forget when estimating.
Add LimitNOFILE=<value> under the [Service] section of the unit file (or a drop-in), then run `systemctl daemon-reload` and restart the service — this is more reliable than /etc/security/limits.conf for services not started through a login shell.