This paper focuses on Red Hat based operating systems. MongoDB recommends adjusting the following configuration on the Linux operating system.
- Modify the operating system user limits for the mongod user. Create the /etc/security/limits.d/99-mongod.conf file with the following lines.
mongod soft nofile 64000
mongod hard nofile 64000
mongod soft nproc 64000
mongod hard nproc 64000
mongod soft memlock unlimited
mongod hard memlock unlimited
- To disable transparent hugepages, append the following to the GRUB_CMDLINE_LINUX line in the /etc/default/grub file.
transparent_hugepage=never
- Reboot the system.
- To disable NUMA, use one of the following methods.
- Disable NUMA on the BIOS on a physical server. This method does not apply to the PowerStore X model internal ESXi nodes.
- Disable vNUMA on a VM.
- If hot-add CPU is enabled on a VM, it automatically disables the vNUMA feature for that VM.
- If NUMA is not disabled, start the mongod process with the following numactl command that would achieve similar effect of turning off numa.
# numactl --interleave=all mongod -f /etc/mongod.conf
- Depending on your MongoDB settings, you might also need to adjust the Linux parameters. The following lists a few of these parameters.
- fs.file-max
- kernel.pid_max
- kernel.threads-max
- vm.map_map_count
- vm.zone_reclaim_mode
- vm.swappiness
- net.ipv4.tcp_keepalive_time
To review and adjust Linux kernel parameters, run sysctl -p to list all current values. To override any parameter, define the new value in /etc/sysctl.conf or /etc/sysctl.d/${parameter file}. Reload the sysctl file or reboot the system. For more information about MongoDB settings, see the MongoDB documentation.