MongoDB setup on NUMA machine

On mine using CentOS 7.6 is at

/etc/systemd/system/multi-user.target.wants/mongod.service


A previous "service with numactl" question How do I run a service with numactl happens to be about mongodb. Given CentOS 7, the systemd example is relevant, specifically:

Editing /etc/systemd/system/mongod.service.d/numactl.conf to override the exec: ExecStart=/usr/bin/numactl --interleave=all -- /usr/local/bin/mongod $OPTIONS run

Another design option would be to split up your NUMA host into VMs no larger than one node each. Mongo has a clustering capability, although that would be more complex than scaling up. Although, scaling up is not very difficult. And if most VMs ran from one host, there might be a single point of failure.


In first instance be sure that numa is installed and loaded during the startup:

yum search numa | egrep -v devel
# Be sure to install the necessary package, avoid the "devel" ones
yum install numad # numactl

Be sure that numad is loaded during the startup:

systemctl enable numad
service numad start
service numad status
echo 0 | sudo tee /proc/sys/vm/zone_reclaim_mode
sudo sysctl -w vm.zone_reclaim_mode=0
cat /var/log/numa*

Now that the enviroinment is ready:

numactl --interleave=all <path> <options>

The path is the path to the program you are starting and the are any optional arguments to pass to the program.

Have a look here for further clarification:

https://docs.mongodb.com/manual/administration/production-notes/#mongodb-and-numa-hardware