Systemd service file directives

I’ve been working making changes to the caddy.service file to suit my needs. I noticed the following two curios:

The systemd service file includes the LimitNOFILE directive, set to “1048576”. This increases the soft and hard limits of open file descriptors. The defaults here are 1024:524288.

According to the docs this directive should not be used: “Don’t use. Be careful when raising the soft limit above 1024, since select(2) cannot function with file descriptors above 1023 on Linux. Nowadays, the hard limit defaults to 524288, a very high value compared to historical defaults. Typically applications should increase their soft limit to the hard limit on their own, if they are OK with working with file descriptors above 1023, i.e. do not use select(2).”

Should this directive be elided entirely? If an out-of-the-box Caddy instance really needs to support this many open file descriptors, would a better value be 1024:1048576, to preserve the recommended soft limit?

Secondly, purely out of curiosity, does anyone know the thinking behind the LimitNPROC=512 value (limit number of processes per user)? The default on my system is 46814 and both seem a bit high!

This topic was automatically closed after 60 days. New replies are no longer allowed.