加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

redhat – 配置透明的Hugepages; [总是],[madvise]或[never]

发布时间:2020-12-14 02:33:34 所属栏目:Linux 来源:网络整理
导读:我们有一堆通用的Centos 7 LAMP堆栈服务器,它们运行带有底层MariaDB数据库的apache. 从RedHat Performance Tuning docs for RHEL 6: Trasparent Hugepages (THP) hides much of the complexity in using huge pages from system administrators and develop
我们有一堆通用的Centos 7 LAMP堆栈服务器,它们运行带有底层MariaDB数据库的apache.

从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更聪明的情况?

解决方法

这是选择加入(madvise)和选择退出(总是)之间的区别.对THP敏感的应用程序甚至可以在transparent_hugepages = always下选择退出.例如,使用jemalloc的应用程序对它非常敏感(redis,go rt,rust rt),jemalloc在编译时提供选项,作为使用MADV_NOHUGEPAGE的分配器配置的一部分.从内核3.15(RHEL7附带3.10)开始,他们可以使用prctl(PR_SET_THP_DISABLE)在每个进程的基础上选择退出.

默认值通常应该很好,因为数据位置是进行大量分配的应用程序的一个非常常见的属性.数据库是一个值得注意的例外,它们在大量大型分配中访问小块(并且它们可以禁用THP).

transparent hugepages的内核文档表明,transparent_hugepage =从不是一个调试选项,而不是推荐的解决方案.当软件出错时,它最好是transparent_hugepage = madvise;即.当开发人员错误地使用MADV_HUGEPAGE时.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读