[20160517]11G HugePage的使用问题2.txt

[20160517]11G HugePage的使用问题2.txt

--昨天测试了HUGEPAGE的使用问题,自己也看了一些文档,从11.2.0.2,加入了参数use_large_pages.

SYS@book> @ &r/ver1
PORT_STRING         VERSION        BANNER
------------------- -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SYS@book> show parameter use_large_pages
NAME            TYPE    VALUE
--------------- ------- -------
use_large_pages string  TRUE

如果参数为True,那么当系统的HugePage被使用尽,只有small pages的情况下,SGA也会继续运行。此时,Oracle实例就运行在内存使用
混合模式(Mixed Mode)下。

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

如果参数为是false,就不使用HugePage.

--使用HugePage好处多多,特别是现在内存大,连接用户多的情况下优势更加明显.

1.先测试use_large_pages=only的情况.

--我采用手工设置,版本11.2.0.4.

SYS@book> show parameter sga_
NAME          TYPE        VALUE
------------- ----------- -------
sga_max_size  big integer 608M
sga_target    big integer 0

SYS@book> show parameter db_cache_size
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------
db_cache_size                        big integer 408M
SYS@book> show parameter shared_pool_size
NAME                                 TYPE        VALUE
------------------------------------ ----------- -------
shared_pool_size                     big integer 172M

--关闭数据库,设置vm.nr_hugepages = 200.

SYS@book> startup nomount
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
SYS@book> alter system set use_large_pages=only scope=spfile ;
System altered.

SYS@book> shutdown immediate ;
ORA-01507: database not mounted
ORACLE instance shut down.

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

--我设置vm.nr_hugepages=200,也就是400M,不够数据库启动,报错.修改参数回来.

2.测试use_large_pages=true的情况.

SYS@book> create pfile='/tmp/a.ora'  from spfile;
File created.

--删除use_large_pages那行.

SYS@book> create spfile from pfile='/tmp/a.ora' ;
File created.

SYS@book> startup nomount
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

$ cat /proc/meminfo | grep -i huge
AnonHugePages:     18432 kB
HugePages_Total:     200
HugePages_Free:       99
HugePages_Rsvd:       99
HugePages_Surp:        0
Hugepagesize:       2048 kB

************************ Large Pages Information *******************
Per process system memlock (soft) limit = 51 GB

Total Shared Global Region in Large Pages = 400 MB (65%)

Large Pages used by this instance: 200 (400 MB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 200 (400 MB)
Large Page size = 2048 KB

RECOMMENDATION:
  Total System Global Area size is 610 MB. For optimal performance,
  prior to the next instance restart:
  1. Increase the number of unused large pages by
at least 105 (page size 2048 KB, total size 210 MB) system wide to
  get 100% of the System Global Area allocated with large pages
********************************************************************

--仅仅使用400*65/100=260M,提示增加105就ok了.

3.设置更小vm.nr_hugepages=50看看.
# cat /proc/meminfo  | grep huge -i
AnonHugePages:      8192 kB
HugePages_Total:      50
HugePages_Free:       50
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB

SYS@book> startup nomount
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

$ cat /proc/meminfo | grep -i huge
AnonHugePages:     20480 kB
HugePages_Total:      50
HugePages_Free:       24
HugePages_Rsvd:       24
HugePages_Surp:        0
Hugepagesize:       2048 kB

************************ Large Pages Information *******************
Per process system memlock (soft) limit = 51 GB
Total Shared Global Region in Large Pages = 100 MB (16%)
Large Pages used by this instance: 50 (100 MB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 50 (100 MB)
Large Page size = 2048 KB

RECOMMENDATION:
  Total System Global Area size is 610 MB. For optimal performance,
  prior to the next instance restart:
  1. Increase the number of unused large pages by
at least 255 (page size 2048 KB, total size 510 MB) system wide to
  get 100% of the System Global Area allocated with large pages
********************************************************************

--仅仅使用400*16/100=16M,提示增加255就ok了.

--有了这些提示修改就方便了.修改为vm.nr_hugepages = 305就正好合适.
************************ Large Pages Information *******************
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
********************************************************************

# cat /proc/meminfo  | grep huge -i
AnonHugePages:     26624 kB
HugePages_Total:     305
HugePages_Free:       94
HugePages_Rsvd:       94
HugePages_Surp:        0
Hugepagesize:       2048 kB

--有一些概念还是不清楚,这个的HugePages_Free表示什么,还没用吗?如果在数据库做一些操作HugePages_Free会减少.视乎不受一次分配
--到位的.

# cat /proc/meminfo  | grep huge -i
AnonHugePages:     36864 kB
HugePages_Total:     305
HugePages_Free:       81
HugePages_Rsvd:       81
HugePages_Surp:        0
Hugepagesize:       2048 kB

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

转载于:http://blog.itpub.net/267265/viewspace-2101170/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值