Skip to content
Advertisement

Starting a process using systemd on Linux: different behaviour using “su root -c”

We have a SignalR push server using Mono/Owin on a Linux Debian server.

We perform a load test and we get a different behaviour according to how the push is started on systemd

Working: ExecStart=/bin/su root -c ‘/usr/bin/mono –server mydaemon.exe -l:/var/run/mydaemon.pid’

Hanging after around 1k connections: ExecStart=/usr/bin/mono –server mydaemon.exe -l:/var/run/mydaemon.pid

We may reproduce the different behaviour anytime: in the second case, the test client stay in SignalR negotiate call, without receiving any answer. We actvated as well the export of the environment varables “max thread” for Mono for both case.

So the question is, what could be the difference in resource system usage/avaliability in these 2 cases?

Advertisement

Answer

In the systemd service definition, you can specify the limit for the number of open files, so if you add a line:

LimitNOFILE=65536

in the [Service] section of the service definition file, it should set the limit to that value, rather than the default which comes through systemd as 1024.

The systemd-system.conf file defines the parameters for defaults for the limits (e.g. DefaultLimitNOFILE), and the systemd.exec manual page defines the parameters that can be used to set overrides on the various limits.

Advertisement