[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Best way to set maximum number of open descriptors for a process



Daniel Bareiro <daniel-listas@gmx.net> wrote:
> On 08/02/17 10:20, Greg Wooledge wrote:

>>> The process starts as a service, so it does not require a shell:

>>> I had thought that I could add something to the script that starts the
>>> process, but I'm not sure if it's the best idea from the point of view
>>> of maintainability because a package update could eliminate that change.

>> I believe the correct approach is to add one of the limitXXXX= directives
>> to the systemd unit.  See systemd.exec(5) for details.  Searching for
>> the word "limit" gets you to the correct section.

> Very interesting. Thanks for the reference! I see that in this case the
> directive to use is LimitNOFILE=<something>. Although I did not find the
> syntax (for example, LimitNOFILE=soft:hard).

The documentation is in systemd.exec(5).

> In this case, it seems that the service file for systemd is created
> dynamically. Or I'm wrong?

> --------------------------------------------------------------------
> root@conference:~# find / -name jitsi-videobridge.service
> /sys/fs/cgroup/systemd/system.slice/jitsi-videobridge.service
> /run/systemd/generator.late/jitsi-videobridge.service
> /run/systemd/generator.late/runlevel5.target.wants/jitsi-videobridge.service
> /run/systemd/generator.late/runlevel4.target.wants/jitsi-videobridge.service
> /run/systemd/generator.late/runlevel3.target.wants/jitsi-videobridge.service
> /run/systemd/generator.late/runlevel2.target.wants/jitsi-videobridge.service
> --------------------------------------------------------------------

> Thanks for your reply.

You can also generate override files for dynamically generated units by
creating /etc/systemd/system/jitsi-videobridge.service.d/configname.conf

"configname" can be whatever you want.

In this file you then put

,----
| [Service]
| LimitNOFILE=65536
`----

and do a "systemctl daemon-reload".

If you now "systemctl cat jitsi-videobridge.service" you should get the
output of the generated file and your appended override config.

Grüße,
Sven

-- 
Sigmentation fault. Core dumped.


Reply to: