[20191129]關於hugepages的問題.txt

lfree發表於2019-11-29

[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根本看不到這樣的情況.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2666149/,如需轉載,請註明出處,否則將追究法律責任。

相關文章