龙空技术网

redhat6.5 禁用透明的大页内存——transparent_hugepage(TPH)

波波说运维 413

前言:

现在大家对“redhat8重启网络命令”大体比较注意,我们都想要分析一些“redhat8重启网络命令”的相关资讯。那么小编也在网摘上网罗了一些有关“redhat8重启网络命令””的相关内容,希望同学们能喜欢,小伙伴们一起来了解一下吧!

概述

1:从RedHat 6, OEL 6, SLES 11 and UEK2 kernels 开始,系统缺省会启用 Transparent HugePages :用来提高内存管理的性能透明大页(Transparent HugePages )和之前版本中的大页功能上类似。主要的区别是:Transparent HugePages 可以实时配置,不需要重启才能生效配置;

2:Transparent Huge Pages在32位的RHEL 6中是不支持的。

Transparent Huge Pages are not available on the 32-bit version of RHEL 6.

3: ORACLE官方不建议我们使用RedHat 6, OEL 6, SLES 11 and UEK2 kernels 时的开启透明大页(Transparent HugePages ), 因为透明大页(Transparent HugePages ) 存在一些问题:

1.在RAC环境下 透明大页(Transparent HugePages )会导致异常节点重启,和性能问题;

2.在单机环境中,透明大页(Transparent HugePages ) 也会导致一些异常的性能问题;

下面主要介绍下怎么去禁用透明大页功能。

查看是否启用透明大页

1:命令cat /sys/kernel/mm/redhat_transparent_hugepage/enabled 该命令适用于Red Hat Enterprise Linux系统

[root@node2 yum.repos.d]# more /etc/issueRed Hat Enterprise Linux Server release 6.5 (Santiago)Kernel \r on an \m​[root@node2 yum.repos.d]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled[always] madvise never

2:命令cat /sys/kernel/mm/transparent_hugepage/enabled 该命令适用于其它Linux系统

[root@node2 yum.repos.d]# cat /sys/kernel/mm/transparent_hugepage/enabled[always] madvise never

使用命令查看时,如果输出结果为[always]表示透明大页启用了。[never]表示透明大页禁用、[madvise]表示

3:如何HugePages_Total返回0,也意味着透明大页禁用了

[root@node2 yum.repos.d]# grep -i HugePages_Total /proc/meminfoHugePages_Total: 0

4:cat /proc/sys/vm/nr_hugepages返回0也意味着透明大页禁用了。

[root@node2 yum.repos.d]# cat /proc/sys/vm/nr_hugepages 0
禁用、启用透明大页功能

方法1:设置/etc/grub.conf文件,在系统启动是禁用。

[root@node2 yum.repos.d]# cat /etc/grub.conf # grub.conf generated by anaconda## Note that you do not have to rerun grub after making changes to this file# NOTICE: You have a /boot partition. This means that# all kernel and initrd paths are relative to /boot/, eg.# root (hd0,0)# kernel /vmlinuz-version ro root=/dev/sda3# initrd /initrd-[generic-]version.img#boot=/dev/sdadefault=0timeout=5splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle Red Hat Enterprise Linux (2.6.32-431.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=5cb1298d-30a9-45ef-b940-fff47ffc2c30 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet initrd /initramfs-2.6.32-431.el6.x86_64.imgtransparent_hugepage=never

方法2:设置/etc/rc.local文件

[root@node1 yum.repos.d]# cat /etc/rc.local #!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.​touch /var/lock/subsys/local​if test -f /sys/kernel/mm/redhat_transparent_hugepage/enabled; then echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabledfi

使用上面的配置后必须重启操作系统才能生效,你也可以运行下面命令不用重启操作系统。

You must reboot your system for the setting to take effect, or run the following two echo lines to proceed with the install without rebooting:

[root@node2 yum.repos.d]# echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled[root@node2 yum.repos.d]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabledalways madvise [never]

后面会分享更多关于devops和DBA方面的内容,感兴趣的朋友可以关注下!!

最后附上朋友的一张支付宝活动福利,扫一扫瓜分15亿!

标签: #redhat8重启网络命令