hardc0der
hardc0der

Reputation: 469

MongoDB: soft rlimits too low. rlimits set to 27774 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files

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.

Upvotes: 4

Views: 7984

Answers (3)

user2974878
user2974878

Reputation: 121

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

@mongodb       soft        nproc      unlimited
@mongodb       hard      nproc        unlimited
@mongodb       soft       nofile      64000
@mongodb       hard      nofile      64000

Upvotes: 1

Ángel Orosa
Ángel Orosa

Reputation: 1

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.

Upvotes: 0

saccodd
saccodd

Reputation: 1067

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

Upvotes: 0

Related Questions