ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle Linux 7禁用Transparent HugePages

Oracle Linux 7禁用Transparent HugePages

原创 Linux操作系统 作者:eric0435 时间:2016-03-29 11:46:55 0 删除 编辑

Transparent HugePages内存在Red Hat企业Linux 6,SUSE 11和Oracle Linux 6的Oracle Linux Unbreakable Enterprise Kernel2(UEK2)早期版本中默认是启用的。Transparent HugePages内存在Oracle Linux Unbreakable Enterprise Kernel2(UEK2)内核中默认情况下是禁用的。"tuned.service"在Oracle Linux7中默认是将transparent_hugepage设置为always。即使在grub内核命令行中它是禁用的,在boot时tuned service将被设置为'always'。在UEK3中默认情况下是禁用的。

Transparent HugePages可能会造成内存在运行时的延迟分配。为了避免性能问题,Oracle强烈建议对所有Oracle数据库服务器禁用Transparent HugePages。为了提高性能Oracle建议使用标准HugePages。

Transparent HugePages内存与标准HugePages内存的差异在于内核khugepaged线程在运行时动态分配内存。标准HugePages内存是在启动时预先分配在运行时不会发生改变。
1.检查Transparent HugePage是否被启用

[root@oracle12c ~]# uname -r
3.10.0-123.el7.x86_64
[root@oracle12c ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never ---这说明Transparent Hugepage被启用

2.有两种禁用Transparent HugePage的模式
2.1对吞吐性能方面全局禁用Transparent HugePage
先对文件/usr/lib/tuned/throughput-performance/tuned.conf进行备份

[root@oracle12c ~]# ls -lrt /usr/lib/tuned/throughput-performance/tuned.conf*
-rw-r--r--. 1 root root 2050 May 7 2014 /usr/lib/tuned/throughput-performance/tuned.conf
-rw-r--r--. 1 root root 2050 Mar 29 11:04 /usr/lib/tuned/throughput-performance/tuned.conf.bkp

[root@oracle12c ~]# more /usr/lib/tuned/throughput-performance/tuned.conf | grep "transparent_hugepages"
transparent_hugepages=always

修改文件/usr/lib/tuned/throughput-performance/tuned.conf,将其中的
[vm]
transparent_hugepages=always
修改为
[vm]
transparent_hugepages=never

[root@oracle12c ~]# more /usr/lib/tuned/throughput-performance/tuned.conf | grep "transparent_hugepages"
transparent_hugepages=never

重启操作系统来验证修改结果

[root@oracle12c ~]# uname -r
3.10.0-123.el7.x86_64
[root@oracle12c ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

2.2.对正使用的调整概要文件禁用Transparent HugePage
先识别正使用的调整概要文件

[root@oracle12c ~]# tuned-adm active
Current active profile: virtual-guest --这说明当前正使用的概要文件是Virtual-guest

Virtual-guest profile是使用文件/usr/lib/tuned/virtual-guest/tuned.conf,并且它包含了来自文件/usr/lib/tuned/throughput-performance/tuned.conf中的"throughput-performance"。首先对文件/usr/lib/tuned/virtual-guest/tuned.conf进行备份

[root@oracle12c ~]# cp /usr/lib/tuned/virtual-guest/tuned.conf /usr/lib/tuned/virtual-guest/tuned.conf.bkp
[root@oracle12c ~]# ls -lrt /usr/lib/tuned/virtual-guest/tuned.conf*
-rw-r--r--. 1 root root 697 Nov 6 2013 /usr/lib/tuned/virtual-guest/tuned.conf
-rw-r--r--. 1 root root 697 Mar 29 11:26 /usr/lib/tuned/virtual-guest/tuned.conf.bkp

[root@oracle12c ~]# more /usr/lib/tuned/virtual-guest/tuned.conf
#
# tuned configuration
#

[main]
include=throughput-performance

[sysctl]
# If a workload mostly uses anonymous memory and it hits this limit, the entire
# working set is buffered for I/O, and any more write buffering would require
# swapping, so it's time to throttle writes until I/O can catch up. Workloads
# that mostly use file mappings may be able to use even higher values.
#
# The generator of dirty data starts writeback at this percentage (system default
# is 20%)
vm.dirty_ratio = 30

# Filesystem I/O is usually much more efficient than swapping, so try to keep
# swapping low. It's usually safe to go even lower than this on systems with
# server-grade storage.
vm.swappiness = 30

向文件/usr/lib/tuned/virtual-guest/tuned.conf中增加"transparent_hugepages=never"来禁用
Transparent HugePage

[root@oracle12c ~]# vi /usr/lib/tuned/virtual-guest/tuned.conf
#
# tuned configuration
#

[main]
include=throughput-performance
[vm]
transparent_hugepages=never
[sysctl]
# If a workload mostly uses anonymous memory and it hits this limit, the entire
# working set is buffered for I/O, and any more write buffering would require
# swapping, so it's time to throttle writes until I/O can catch up. Workloads
# that mostly use file mappings may be able to use even higher values.
#
# The generator of dirty data starts writeback at this percentage (system default
# is 20%)
vm.dirty_ratio = 30

# Filesystem I/O is usually much more efficient than swapping, so try to keep
# swapping low. It's usually safe to go even lower than this on systems with
# server-grade storage.
vm.swappiness = 30

重启操作系统来验证结果

[root@oracle12c ~]# uname -r
3.10.0-123.el7.x86_64
[root@oracle12c ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26015009/viewspace-2071593/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
系统架构师,ACOUG MEMBER,Oracle ACE,Mail:yongjing.star@gmail.com Mobile:13875984558 QQ:409898894 Blog:www.jydba.net

注册时间:2011-10-12

  • 博文量
    538
  • 访问量
    6200083