首页 » ORACLE 9i-23ai, 系统相关 » How to config Hugepage when 1M hugepagesize on IBM LinuxOne

How to config Hugepage when 1M hugepagesize on IBM LinuxOne

对于oracle、Postgresql都建议配置Hugepages, 通常RHEL linux上看到的hugepage size默认都是2M, 并且在Oracle 19c的db alert log中实例启动时有对于hugepage 使用个数的提示, 但是只有4k, 2M, 最近发现一客户IBM linuxone环境的Linux默认hugepage size为1MB(for IBM Z the hardware page size is 1 MB.), 那在配置hugepage时, DB alert log关于hugepage会如何显示?

查看Hugepage size

通常linux hugepages大小是1MB, 2MB, 1GB, 如果安装了libhugetlbfs-utils 包可以使用hugeadm工具查看和配置hugepage:

yum -y install libhugetlbfs libhugetlbfs-utils

hugeadm --pool-list

如果没有安装hugeadm,可以从/proc/meminfo查看当前默认值

# grep Hugepagesize /proc/meminfo
Hugepagesize:       2048 kB

在Linuxone要检查您的环境中是否支持1mb的大页面,请注意/proc/cpuinfo中是否存在edat标志:

# grep edat /proc/cpuinfo 
features        : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te

要检查CPU是否支持HugePages 2MB大小,请注意/proc/cpuinfo中是否存在pse标志:

[root@oel7db1 ~]# cat /proc/cpuinfo|grep pse|head -n 1
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase avx2 invpcid rdseed

要检查CPU是否支持HugePages 1GB大小,请注意/proc/cpuinfo中是否存在pdpe1gb标志:

# cat /proc/cpuinfo | grep pdpe1gb | head -n 1
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf ea

从zEC12开始,如果Linux运行在LPAR上,您还在IBM Z可以配置2 GB的大页面。您可以分配多个大页面池并同时使用它们。要分配多个大页面池,可以多次指定hugepagesz=参数,每次后跟一个相应的hugepages=参数。例如,要指定两个池,一个有1mb的页面,一个有2gb的页面,指定:

hugepagesz=1M hugepages=8 hugepagesz=2G hugepages=2

 Linuxone的配置 Hugepage

# cat /proc/meminfo |grep -i hugepagesize
Hugepagesize: 1024 kB

SGA=30GB

# cat /proc/meminfo |grep -i hugepage

AnonHugePages: 0 kB
HugePages_Total: 32000
HugePages_Free: 32000
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 1024 kB

$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 14 16:03:27 2022
Version 19.4.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.

SQL> startup
ORACLE instance started.

# cat /proc/meminfo |grep -i hugepage
AnonHugePages: 0 kB
HugePages_Total: 32000
HugePages_Free: 15516
HugePages_Rsvd: 13662
HugePages_Surp: 0
Hugepagesize: 1024 kB

db alert log 部分输出

2022-12-14T16:03:30.948925+08:00
 Per process system memlock (soft) limit = UNLIMITED
2022-12-14T16:03:30.948969+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 29G
2022-12-14T16:03:30.949050+08:00
 Available system pagesizes:
  4K, 2048K 
2022-12-14T16:03:30.949129+08:00
 Supported system pagesize(s):
2022-12-14T16:03:30.949171+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2022-12-14T16:03:30.949213+08:00
        4K       Configured              11              11        NONE
2022-12-14T16:03:30.949285+08:00
     2048K            16927           15073           15073        NONE
2022-12-14T16:03:30.949327+08:00
**********************************************************************

Note:
虽然OS 是hugepagesize为1MB, 我们在OS层配置了32000 个hugepage, 但在db alert log中依旧只显示4k和2M,猜测是代码级写死,但是pages它自动做了换算,提示我们配置的hugepage和预期分配页、已经扩展页数都是/2M计算后的个数据。

把hugepages 降低vm.nr_hugepages = 15100, 重启OS 和db instance

# cat /proc/meminfo |grep -i hugepage

AnonHugePages:         0 kB
HugePages_Total:   15100
HugePages_Free:     6876
HugePages_Rsvd:     6836
HugePages_Surp:        0
Hugepagesize:       1024 kB


db alert log

**********************************************************************
2022-12-14T15:43:10.695938+08:00
Dump of system resources acquired for SHARED GLOBAL AREA (SGA) 

2022-12-14T15:43:10.696010+08:00
 Per process system memlock (soft) limit = UNLIMITED
2022-12-14T15:43:10.696052+08:00
 Expected per process system memlock (soft) limit to lock
 instance MAX SHARED GLOBAL AREA (SGA) into memory: 29G
2022-12-14T15:43:10.696132+08:00
 Available system pagesizes:
  4K, 2048K 
2022-12-14T15:43:10.696212+08:00
 Supported system pagesize(s):
2022-12-14T15:43:10.696254+08:00
  PAGESIZE  AVAILABLE_PAGES  EXPECTED_PAGES  ALLOCATED_PAGES  ERROR(s)
2022-12-14T15:43:10.696296+08:00
        4K       Configured              11         3861840        NONE
2022-12-14T15:43:10.696373+08:00
     2048K             7570           15073            7530        NONE
2022-12-14T15:43:10.696414+08:00
RECOMMENDATION:
2022-12-14T15:43:10.696454+08:00
 1. For optimal performance, configure system with expected number 
 of pages for every supported system pagesize prior to the next 
 instance restart operation.
2022-12-14T15:43:10.707786+08:00
**********************************************************************

Note:
把OS的Hugepges改成DB的一半时,也能看到DB alert log中OS中配置页7570预期页是15073,但是只使用了7530.

Hugepage 记算方法

( HugePages_Total - HugePages_Free ) + HugePages_Rsvd = HugePages Usage

( HugePages_Total - HugePages Usage) x Hugepagesize

打赏

对不起,这篇文章暂时关闭评论。