0
Good morning. I have an Ubuntu 16.04 LTS server, hosted on Linode. Last night I spent all night reading articles and testing settings to increase Mongodb’s connection capacity, but nothing worked. At the moment Mongo has 819 available, which would be 80% of 1024.
I tried to increase the file limit with the command ulimit -n 64000
but the same only affects my user, and after relocating back to 1024.
I changed the file /etc/sysctl.conf
and added the line fs.file-max = 64000
, but it didn’t work.
I changed the file /etc/security/limits.conf
and added the following lines, one by one to test (always restarting the server between each change):
* - nofile 64000
root - nofile 64000
mongodb - nofile 64000
mongodb - nproc 64000
After this configuration the ulimit -a
returns:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 48041
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 64000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 48041
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
I created the file /etc/security/limits.d/99-mongodb-nproc.conf
with the configuration * - nofile 64000
and it didn’t work either.
I also put the line session required pam_limits.so
in the archives /etc/pam.d/common-session
and /etc/pam.d/common-session-noninteractive
and nothing.
Man /etc/systemd/system/mongod.service
is running mongod with the argument --maxConns 51200
and the mongo.conf
is with maxIncomingConnections: 51200
When I execute the command db.serverStatus().connections
in the shell of Mongo, he returns to me { "current" : 9, "available" : 810, "totalCreated" : NumberLong(68349) }
.
I don’t know what else to try. Someone can help me?
Good morning @ataquino, did you ever restart the server? these changes involve modifying the kernel parameters and may require a reboot of the machine.
– mrlew
I forgot to inform that every change I restarted the service and if it did not work I would restart the server.
– ataquino