[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



Hi, Tomas.

On 08/02/17 08:42, tomas@tuxteam.de wrote:

>> Maybe I could add something to the startup script, but maybe if the
>> Debian package is updated, these changes will be lost. What do you
>> suggest is the best way?

> Yes, if the process is being started via a shell, ulimit seems the
> way to go. In SysV init, either in the start script or perhaps in
> /etc/defaults (which is then picked up by the start script).
> 
> Note that /etc is "taboo" for the distro[1], i.e. it will install
> something there, but in won't touch anything which wasn't installed
> by the distro, at least not without asking.
> 
> Sure systemd has a way to do that, but for that I'll have to defer
> to the systemd experts.
> 
> [1] at least for civilised distros, like Debian.

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

-----------------------------------------------------------------------
root@conference:~# systemctl status jitsi-videobridge
● jitsi-videobridge.service - LSB: Jitsi Videobridge
   Loaded: loaded (/etc/init.d/jitsi-videobridge)
   Active: active (running) since Tue 2017-02-07 08:25:10 ART; 24h ago
  Process: 410 ExecStart=/etc/init.d/jitsi-videobridge start
(code=exited, status=0/SUCCESS)
   CGroup: /system.slice/jitsi-videobridge.service
           └─434 java -Xmx3072m -XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/tmp
-Djava.library.path=/usr/share/jitsi-videobridge/lib/native/linux-64 -...

Warning: Journal has been rotated since unit was started. Log output is
incomplete or unavailable.
-----------------------------------------------------------------------

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.

Another alternative might be to add something like this to /etc/rc.local:

-----------------------------------------------------------------------
PID_JVB=`ps -u jvb | tail -1 | awk '{ print $1 }'`
prlimit --pid $PID_JVB --nofile=10240:10240
-----------------------------------------------------------------------

But perhaps there is another more elegant way to achieve this.


Thanks for your reply.

Kind regards,
Daniel

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: