if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
复制代码
2.执行脚本使配置生效:
bash /etc/rc.local
复制代码
关闭系统大页内存功能缘故起因:
Transparent Huge Pages (THP) is a Linux memory management system that reduces the overhead of
Translation Lookaside Buffer (TLB)
大页内存是一种Linux系统中的内存管理系统,可以减少编译后备缓冲区(TLB)的开销;
lookups on machines with large amounts of memory by using larger memory pages.
通过使用较大的内存页在具有大量内存的机器上查找
However, database workloads often perform poorly with THP.
通常使用THP时,数据库工作负载表现常常是不佳的
because they tend to have sparse rathar than contiguous memory access patterns.
由于相较于相邻的访问模式,更倾向于系统的访问模式
You should disable THP on Linux machines to ensure best performance with MongoDB
1.2.2 执行安装