4

I have an Ubuntu server which is running on 14.04.05 LTS.

There are several applications that is ugins mongodb installed also on this server. MongoDB version is 3.4.2

I'm trying to increase max process ulimit of mongodb process.

I first put these lines to /etc/security/limits.conf

* soft nproc unlimited * hard nproc unlimited * soft nofile 64000 * hard nofile 64000 * soft sigpending unlimited * hard sigpending unlimited root soft nproc unlimited root hard nproc unlimited root soft nofile 64000 root hard nofile 64000 root soft sigpending unlimited root hard sigpending unlimited mongodb soft nproc unlimited mongodb hard nproc unlimited mongodb soft nofile 64000 mongodb hard nofile 64000 mongodb soft sigpending unlimited mongodb hard sigpending unlimited

and also put required pam.limits to proper locations and reboot but no success.

Then i tried to manually run ulimit -u unlimited command which is reflected immediately after i executed it (i seen the result with ulimit -a command). And then reboot the mongodb process but the limits are didn't changed.

Then i tried to put these lines to:

ulimit -f unlimited ulimit -t unlimited ulimit -v unlimited ulimit -n 64000 ulimit -m unlimited ulimit -u unlimited

to /etc/init.d/mongodb file and try to start mongodb process with /etc/init.d/mongodb start but i got this error:

/etc/init.d/mongodb: 67: ulimit: Illegal option -u

I also put this line mongod soft nproc 64000 to /etc/security/limits.d/90-nproc.conf and tried to reboot but no success.

On this thread https://stackoverflow.com/questions/9361816/maximum-number-of-processes-in-linux i saw that one user reported about kernel.threads-max is limiting this number but on my another server i can get more max connection limit then kernel.threads-max / 2

So I'm not sure where do i doing wrong but any help is much appreciated.

hardc0der
  • 449
  • 2
  • 7
  • 13

3 Answers3

1

Adding "@" to the lines is working for me:

@mongodb       soft        nproc      unlimited
@mongodb       hard      nproc        unlimited
@mongodb       soft       nofile      64000
@mongodb       hard      nofile      64000
user2974878
  • 121
  • 1
  • 3
0

Try adding -S to each line, like this: ulimit -S -n 4096

saccodd
  • 972
  • 9
  • 23
0

For the change to be persistent you have to edit de init script, for example, in Red Hat 7, the init script has the following line:

LimitNOFILE=64000

You have to add the next one:

LimitNPROC=32000

Then restart the service.

I hope this helps.