You should read below articles before reading this article.
“How to improve database performance on MongoDB part 1“,
“How to improve database performance on MongoDB part 2”
Ensure you have the right configuration
The default configurations are not optimal for MongoDB. Must be applied some changes.
NUMA:
Many modern multiprocessors have non-uniform memory access (NUMA) memory designs, where the performance of a process can depend on whether the memory range being accessed is attached to the local CPU or to another CPU.
Running MongoDB on a system with Non-Uniform Access Memory (NUMA) can cause a number of operational problems, including the slow performance for periods of time and high system process usage. DIABLE NUMA
How to know if Numa is enabled:
1 | <find /proc|grep –i numa> |
Or
1 | <grep NUMA=y /boot/config-`uname -r`> |
Numa it’s enabled.
READAHEAD:
Readahead is a system call of the Linux kernel that loads a file’s contents into the page cache.
Readahead size should be set to 0 when using WiredTiger storage engine. A readahead value of 32 typically works well when using MMAPv1.
How to know the value of readahead:
1 | < blockdev –-report> |
How to change it and check
1 | <blockdev --setra {device} > |
The report again
FileSystems types:
With the WiredTiger storage engine, use of XFS is strongly recommended to avoid performance issues.
How to review it:
1 | < df -T> |
NOATIME
Most file systems will maintain metadata for the last time a file was accessed. While this may be useful for some applications, in a database it means that the file system will issue a write every time the database accesses a page, which will negatively impact the performance and throughput of the system.
How to check it:
1 2 3 4 5 6 7 | <cat /etc/fstab> /dev/mapper/sys-home /home xfs nodev,nosuid 0 2 to change it, update your /etc/fstab and add noatime to the options field. /dev/mapper/sys-home /home xfs nodev,nosuid,noatime 0 2. |
To be continued.