0927hugepages与nr_overcommit_hugepages

简介: [20170927]hugepages与内核参数nr_overcommit_hugepages.txt /proc/sys/vm/nr_overcommit_hugepages specifies how large the pool of huge pages c...

[20170927]hugepages与内核参数nr_overcommit_hugepages.txt

/proc/sys/vm/nr_overcommit_hugepages specifies how large the pool of huge pages can grow, if more huge pages than
/proc/sys/vm/nr_hugepages are requested by applications. Writing any non-zero value into this file indicates that the
hugetlb subsystem is allowed to try to obtain that number of "surplus" huge pages from the kernel's normal page pool,
when the persistent huge page pool is exhausted. As these surplus huge pages become unused, they are freed back to the
kernel's normal page pool.

--//从上面的说明可以看出设置这个参数可以减少hagepages的使用,避免设置过大导致的浪费.
--//我以前提到参数use_large_pages可以设置auto.参考链接:
--//  [20170313]11G use_large_pages参数.txt => http://blog.itpub.net/267265/viewspace-2135210/
--//  [20170516]11G use_large_pages参数2.txt => http://blog.itpub.net/267265/viewspace-2145480/

--//我提到设置参数use_large_pages=auto,虽然/etc/sysctl.conf配置vm.nr_hugepages = 105.
--//但是可以通过oradism命令启动修改内核参数.但是如果关闭数据库,我的测试配置的hugepage不会回收.

--//测试设置nr_overcommit_hugepages会发生什么情况?

1.环境:
# cat /proc/version
Linux version 2.6.39-300.26.1.el5uek (mockbuild@ca-build56.us.oracle.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)) #1 SMP Thu Jan 3 18:31:38 PST 2013

# cat /proc/sys/vm/nr_overcommit_hugepages
0
--//缺省是0.

# cat /proc/meminfo | grep -i hugepage
AnonHugePages:         0 kB
HugePages_Total:     305
HugePages_Free:       96
HugePages_Rsvd:       96
HugePages_Surp:      200
Hugepagesize:       2048 kB

--//数据库配置情况:
SCOTT@book> show sga
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes

SCOTT@book> show parameter use_large_pages
NAME            TYPE   VALUE
--------------- ------ -----
use_large_pages string AUTO

SYS@book> alter system set use_large_pages=only scope=spfile;
System altered.

--//如果参数为是Only,从含义上,表示Oracle实例只会使用HugePage作为内存使用。如果系统在AMM模式或者HugePage用尽的时候,数
--//据库就不能启动或者报错。

--//关闭数据库,修改/etc/sysctl.conf,再启动看看:
SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

--//修改/etc/sysctl.conf
vm.nr_hugepages = 105
vm.nr_overcommit_hugepages=1000

# sysctl -p

# cat /proc/meminfo | grep -i hugepage
AnonHugePages:         0 kB
HugePages_Total:     105
HugePages_Free:      105
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
--//现在HugePages_Total: 105

--//注意检查修改/etc/security/limits.conf内容:
oracle soft    memlock        unlimited
oracle hard    memlock        unlimited

--//再启动数据库看看:
SYS@book> startup
ORACLE instance started.
Total System Global Area  634732544 bytes
Fixed Size                  2255792 bytes
Variable Size             197133392 bytes
Database Buffers          427819008 bytes
Redo Buffers                7524352 bytes
Database mounted.
Database opened.

--//可以发现现在可以正常启动!!检查alert文件:

Starting ORACLE instance (normal)
Specified value of sga_max_size is too small, bumping to 637534208
************************ Large Pages Information *******************
Parameter use_large_pages = ONLY
Per process system memlock (soft) limit = 51 GB
Total Shared Global Region in Large Pages = 610 MB (100%)
Large Pages used by this instance: 305 (610 MB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 305 (610 MB)
Large Page size = 2048 KB
********************************************************************

--//可以发现我现在设置vm.nr_hugepages = 105,实际上使用305,但是数据库可以正常启动,而且use_large_pages = ONLY,也就是强制使
--//用hugepages.通过如下命令也可以发现:

# cat /proc/meminfo | grep -i hugepage
AnonHugePages:         0 kB
HugePages_Total:     305
HugePages_Free:       97
HugePages_Rsvd:       97
HugePages_Surp:      200
Hugepagesize:       2048 kB

SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.

# cat /proc/meminfo | grep -i hugepage
AnonHugePages:         0 kB
HugePages_Total:     105
HugePages_Free:      105
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

--//可以发现使用的hupepages回收了.也就是使用的内存空间回收了.这样的使用方式,可以一定程度避免内存浪费.

3.继续测试现在设置vm.nr_overcommit_hugepages=0.
--//修改/etc/sysctl.conf
vm.nr_hugepages = 105
vm.nr_overcommit_hugepages=0

# sysctl -p
# cat /proc/meminfo | grep -i hugepage
AnonHugePages:         0 kB
HugePages_Total:     105
HugePages_Free:      105
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

SYS@book> startup
ORA-27137: unable to allocate large pages to create a shared memory segment
Linux-x86_64 Error: 12: Cannot allocate memory
Additional information: 624951296
Additional information: 1

--//可以这样无法获得足够的hugepages,数据库无法启动.修改回来后在启动正常.
vm.nr_overcommit_hugepages=1000

总结:
通过设置这个参数,一定程度避免内存浪费,必须设置大的hugepages,而导致一些内存浪费,而且不使用时可以回收.

目录
相关文章
|
存储 5G Windows
5G NR Paging 寻呼
寻呼消息由PCCH逻辑信道承载,PCCH逻辑信道的数据块又是由PCH传输信道来承载,而PCH传输信道的数据块又是由PDSCH物理信道来承载的。
1274 0
5G NR Paging 寻呼
|
前端开发 调度 文件存储
NR paging
IMS 是基于PS domain的网络。LTE时代,IMS建网初期,UE虽然注册IMS,但是网络仍然会下发CS domain paging,进而引起CSFB的问题。当时不少有客户提case,询问这个问题是否正常。其实这个问题只是建网初期,网络端架构不成熟引起的现象,谈不上不正常,能不漏掉paging的手机 ,都是好手机。
|
Oracle 关系型数据库 Java
Configuring HugePages (Doc ID 1479908.1)
Configuring HugePages (Doc ID 1479908.1)
89 0
|
缓存 Oracle 关系型数据库
[201804012]关于hugepages 3.txt
[201804012]关于hugepages 3.txt --//有一段时间我一直强调安装oracle一定要配置hugepage,因为现在的服务器内存越来越大,如果还使用4K的页面表,如果内存表占用内存巨大, --//特别连接数量很大的情况下,更加明显,结果导致内存紧张,使用交换,这些类似的例子网上很多.
868 0
|
SQL Oracle 关系型数据库
|
Oracle 关系型数据库 Linux
|
Oracle 关系型数据库 Linux
|
关系型数据库 Oracle 数据库
[20170927]关于hugepages.txt
[20170927]关于hugepages.txt --//今天测试hugepages与内核参数nr_overcommit_hugepages,才发现HugePages_Surp表示什么? --// [20170209]理解pre_page_sga参数.
995 0