从RedHat Performance Tuning docs for RHEL 6:
Trasparent Hugepages (THP) hides much of the complexity in using huge pages from system administrators and developers. As the goal of THP is improving performance,its developers (both from the community and Red Hat) have tested and optimized THP across a wide range of systems,configurations,applications,and workloads. This allows the default settings of THP to improve the performance of most system configurations. However,THP is not recommended for database workloads.
这听起来很棒,直到数据库部分.实际上,一些MariaDB选项(如TokuDB引擎)实际上需要禁用THP.
我发现许多禁用THP的指南指示将transparent_hugepages = always的默认配置更改为never.
但是,从RedHat Performance Tuning docs for RHEL 7开始:
To prevent applications from allocating more memory resources than necessary,you can disable huge pages system-wide and only enable them inside MADV_HUGEPAGE madvise regions
如果我已经读过这个权利,那么transparent_hugepages = madvise似乎是一个更好的选择,允许从THP中受益的进程使用它们和那些不能使用它们的进程.
我确实找到了one article建议这种方法.
为什么这不是默认选项?
有没有使用transparent_hugepages =从不比madvise更聪明的情况?
解决方法
默认值通常应该很好,因为数据位置是进行大量分配的应用程序的一个非常常见的属性.数据库是一个值得注意的例外,它们在大量大型分配中访问小块(并且它们可以禁用THP).
transparent hugepages的内核文档表明,transparent_hugepage =从不是一个调试选项,而不是推荐的解决方案.当软件出错时,它最好是transparent_hugepage = madvise;即.当开发人员错误地使用MADV_HUGEPAGE时.