[20191129]关于hugepages的问题.txt
--//这几天,论坛上有讨论hugepage的使用问题,链接:
http://www.itpub.net/thread-2121953-1-1.html=>redhat5.8中没有HugePages
http://www.itpub.net/thread-2121961-1-1.html=>LINUX是不是某些版本不支持大页内存功能
--//第一个对方使用XEN版本内核,更换应该没有问题.
--//突然想起是否我设置vm.nr_hugepages = 0,而vm.nr_overcommit_hugepages = 1000是否可以启动.
--//测试看看:
1.环境:
# grep "^vm.nr" /etc/sysctl.conf
vm.nr_hugepages = 0
vm.nr_overcommit_hugepages = 1000
SYS@book> @ 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 ONLY
# cat /etc/security/limits.conf
oracle soft nproc 4095
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
* soft memlock 53248000
* hard memlock 53248000
# sysctl -p
..
# grep -i page /proc/meminfo
AnonPages: 90672 kB
PageTables: 5956 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
2.测试:
SYS@book> startup
ORACLE instance started.
Total System Global Area 643084288 bytes
Fixed Size 2255872 bytes
Variable Size 205521920 bytes
Database Buffers 427819008 bytes
Redo Buffers 7487488 bytes
Database mounted.
Database opened.
--//alert*.log记录如下:
Fri Nov 29 10:10:47 2019
Adjusting the default value of parameter parallel_max_servers
from 480 to 170 due to the value of parameter processes (200)
Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Parameter use_large_pages = ONLY
Per process system memlock (soft) limit = 51 GB
Total Shared Global Region in Large Pages = 618 MB (100%)
Large Pages used by this instance: 309 (618 MB)
Large Pages unused system wide = 0 (0 KB)
Large Pages configured system wide = 309 (618 MB)
Large Page size = 2048 KB
********************************************************************
# grep -i page /proc/meminfo
AnonPages: 174548 kB
PageTables: 14372 kB
AnonHugePages: 0 kB
HugePages_Total: 309
HugePages_Free: 72
HugePages_Rsvd: 72
HugePages_Surp: 309
Hugepagesize: 2048 kB
--//OK没有问题.
--//这样主要可能是内存碎片,可能一下子申请不到这么大的内存,我的测试环境需要很少的内存.
--//也就是这样也可以启动数据库.这样好处关闭数据库内存全部回收.
# free -m
total used free shared buffers cached
Mem: 129161 62561 66600 0 1538 56810
-/+ buffers/cache: 4212 124949
Swap: 30718 0 30718
SYS@book> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
# free -m
total used free shared buffers cached
Mem: 129161 61851 67309 0 1538 56809
-/+ buffers/cache: 3503 125657
Swap: 30718 0 30718
--//回收了67309-66600=709M.
# grep -i page /proc/meminfo
AnonPages: 88944 kB
PageTables: 5912 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
3.总结:
我个人认为使用hugepages是大势所趋,应该作为安装oracle的一个步骤,目前的机器配置内存都很高.
即使是很少的连接,消耗页面表也很大.
# ipcs -m
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 32768 grid 640 4096 0
0x00000000 65537 grid 640 4096 0
0xed304ac0 98306 grid 640 4096 0
0x00000000 1081347 oracle 640 134217728 429
0x00000000 1114116 oracle 640 20132659200 429
0x5145def4 1146885 oracle 640 2097152 429
--//页面表占3694648KB,3694648/1024/1024 = 3.52G.
--//3694648/429 = 8612.23 KB
# grep -i page /proc/meminfo
AnonPages: 6703096 kB
PageTables: 3694648 kB
AnonHugePages: 3147776 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
--//其后台进程的通过smem查询发现.USS占用会越来越大.
# smem -tk -U oracle -P "ora_.*_xxxxx1"
PID User Command Swap USS PSS RSS
21521 oracle ora_vktm_xxxxx1 0 2.2M 2.2M 17.4M
21533 oracle ora_acms_xxxxx1 0 2.2M 2.3M 17.5M
21477 oracle ora_psp0_xxxxx1 0 2.2M 2.3M 18.8M
6842 oracle ora_smco_xxxxx1 0 2.2M 2.4M 20.5M
3536 oracle ora_o003_xxxxx1 0 2.4M 2.5M 21.8M
23477 oracle ora_o001_xxxxx1 0 2.4M 2.6M 22.2M
24160 oracle ora_o002_xxxxx1 0 2.4M 2.6M 22.2M
22075 oracle ora_o000_xxxxx1 0 2.4M 2.6M 22.2M
21555 oracle ora_lmhb_xxxxx1 0 2.6M 2.8M 20.1M
21585 oracle ora_d000_xxxxx1 0 3.0M 3.1M 17.4M
24243 oracle ora_rcbg_xxxxx1 0 2.6M 3.1M 24.9M
21589 oracle ora_s000_xxxxx1 0 3.3M 3.4M 17.6M
21573 oracle ora_reco_xxxxx1 0 3.3M 3.6M 29.3M
21531 oracle ora_ping_xxxxx1 0 3.5M 3.7M 19.5M
24249 oracle ora_qmnc_xxxxx1 0 3.7M 3.8M 22.2M
21553 oracle ora_rms0_xxxxx1 0 3.9M 4.2M 30.7M
13231 oracle ora_w000_xxxxx1 0 3.8M 4.2M 26.8M
21575 oracle ora_rbal_xxxxx1 0 4.0M 4.2M 22.6M
24744 oracle ora_q000_xxxxx1 0 5.1M 5.4M 28.5M
7406 oracle ora_pz98_xxxxx1 0 2.5M 5.8M 81.4M
24241 oracle ora_gtx0_xxxxx1 0 3.4M 6.6M 44.9M
21525 oracle ora_gen0_xxxxx1 0 3.0M 6.6M 63.5M
21475 oracle ora_pmon_xxxxx1 0 4.9M 7.4M 47.6M
23675 oracle ora_arc2_xxxxx1 0 7.2M 7.6M 31.5M
22038 oracle ora_rsmn_xxxxx1 0 7.6M 7.7M 23.4M
28721 oracle ora_q002_xxxxx1 0 6.6M 9.2M 64.7M
21587 oracle ora_mark_xxxxx1 0 11.0M 11.1M 26.4M
21529 oracle ora_dbrm_xxxxx1 0 6.4M 12.3M 106.7M
21577 oracle ora_asmb_xxxxx1 0 4.0M 12.4M 178.1M
21527 oracle ora_diag_xxxxx1 0 10.1M 13.0M 39.4M
21567 oracle ora_lgwr_xxxxx1 0 6.9M 14.9M 78.1M
6972 oracle ora_nsa2_xxxxx1 0 21.6M 27.6M 84.2M
21539 oracle ora_lmd0_xxxxx1 0 18.3M 33.1M 187.4M
23673 oracle ora_arc1_xxxxx1 0 37.0M 37.7M 67.1M
21569 oracle ora_ckpt_xxxxx1 0 5.8M 39.6M 740.9M
24158 oracle ora_nsa3_xxxxx1 0 30.6M 41.0M 140.1M
21535 oracle ora_dia0_xxxxx1 0 35.0M 41.5M 97.0M
21583 oracle ora_mmnl_xxxxx1 0 11.2M 56.8M 193.6M
23417 oracle ora_arc0_xxxxx1 0 57.1M 59.5M 113.1M
23679 oracle ora_arc3_xxxxx1 0 57.7M 59.9M 111.2M
22036 oracle ora_lck0_xxxxx1 0 10.8M 61.8M 840.0M
21537 oracle ora_lmon_xxxxx1 0 13.0M 78.4M 409.9M
24316 oracle ora_cjq0_xxxxx1 0 12.3M 107.8M 1.1G
23217 oracle ora_pz99_xxxxx1 0 10.4M 162.9M 898.5M
21579 oracle ora_mmon_xxxxx1 0 29.4M 255.1M 2.0G
21571 oracle ora_smon_xxxxx1 0 14.0M 281.9M 2.2G
21557 oracle ora_mman_xxxxx1 0 348.1M 687.7M 2.5G
21561 oracle ora_dbw1_xxxxx1 0 120.5M 1.0G 4.9G
21559 oracle ora_dbw0_xxxxx1 0 117.0M 1.1G 5.2G
21563 oracle ora_dbw2_xxxxx1 0 119.7M 1.1G 5.2G
21565 oracle ora_dbw3_xxxxx1 0 135.5M 1.1G 5.2G
21545 oracle ora_lms1_xxxxx1 0 755.5M 2.0G 6.9G
21541 oracle ora_lms0_xxxxx1 0 764.7M 2.1G 7.0G
21549 oracle ora_lms2_xxxxx1 0 791.2M 2.2G 7.4G
-------------------------------------------------------------------------------
54 1 0 3.6G 12.6G 54.4G
--//而使用hugepages根本看不到这样的情况.