欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

[20190321]smem的显示缺陷.txt

程序员文章站 2022-05-03 11:34:07
[20190321]smem的显示缺陷.txt1.smem 加入-m参数显示存在缺陷,map的信息不全:# smem -tk -m -U oracle -P "oraclepeis|ora_"Map PIDs AVGPSS PSS/u01/app/oracle/product/10.2.0/db_1 ......

[20190321]smem的显示缺陷.txt

1.smem 加入-m参数显示存在缺陷,map的信息不全:

# smem -tk -m -u oracle -p "oraclepeis|ora_"
map                                       pids   avgpss      pss
/u01/app/oracle/product/10.2.0/db_1/dbs/    15        0        0
[vdso]                                     308        0        0
[vsyscall]                                 308        0        0
/lib64/libaio.so.1.0.1                     308     3.0k     1.1m
/lib64/libnsl-2.12.so                      308     7.0k     2.1m
/lib64/ld-2.12.so                          308     7.0k     2.1m
/u01/app/oracle/product/10.2.0/db_1/lib/   308     7.0k     2.1m
/u01/app/oracle/product/10.2.0/db_1/lib/   308     7.0k     2.1m
/lib64/libdl-2.12.so                       308     7.0k     2.1m
/lib64/libnss_files-2.12.so                308     7.0k     2.2m
/lib64/libpthread-2.12.so                  308     7.0k     2.2m
/lib64/libm-2.12.so                        308     7.0k     2.3m
/lib64/libc-2.12.so                        308    12.0k     3.7m
/u01/app/oracle/product/10.2.0/db_1/lib/   308    14.0k     4.2m
/u01/app/oracle/product/10.2.0/db_1/lib/   308    21.0k     6.5m
/u01/app/oracle/product/10.2.0/db_1/lib/   308    21.0k     6.5m
/u01/app/oracle/product/10.2.0/db_1/lib/   308    32.0k     9.7m
/u01/app/oracle/product/10.2.0/db_1/lib/   308    56.0k    17.1m
[stack]                                    308    80.0k    24.1m
/u01/app/oracle/product/10.2.0/db_1/lib/   308   103.0k    31.2m
/u01/app/oracle/product/10.2.0/db_1/bin/   308   127.0k    38.3m
<anonymous>                                308   242.0k    72.8m
[heap]                                     308   466.0k   140.5m
/dev/zero                                  308   561.0k   168.9m
/u01/app/oracle/product/10.2.0/db_1/lib/   308   589.0k   177.4m
/u01/app/oracle/product/10.2.0/db_1/lib/   308     1.4m   417.1m
/sysv94f021f8                              308     2.8m   876.1m
-----------------------------------------------------------------
27                                        8023     6.5m     2.0g

--//map部分显示宽度不足.可以加宽到80.很容易修改python的脚本,我不懂python,看一下源代码就可以了.
--//修改前注意备份!!

# diff -nur  smem.org smem
--- smem.org    2019-03-21 11:18:59.117243470 +0800
+++ smem        2013-03-28 11:01:07.000000000 +0800
@@ -330,7 +330,7 @@
     pt = maptotals(p)

     fields = dict(
-        map=('map', lambda n: n, '%-80.80s', len,
+        map=('map', lambda n: n, '%-40.40s', len,
              'mapping name'),
         count=('count', lambda n: pt[n]['count'], '% 5s', sum,
                'number of mappings found'),

# smem.org -tk -m -u oracle -p "oraclepeis|ora_"
map                                                                               pids   avgpss      pss
/u01/app/oracle/product/10.2.0/db_1/dbs/hc_peis.dat                                 15        0        0
[vdso]                                                                             151        0        0
[vsyscall]                                                                         151        0        0
/lib64/libaio.so.1.0.1                                                             151     3.0k   588.0k
/u01/app/oracle/product/10.2.0/db_1/lib/libclsra10.so                              151     7.0k     1.1m
/lib64/libnsl-2.12.so                                                              151     7.0k     1.1m
/lib64/libnss_files-2.12.so                                                        151     7.0k     1.1m
/u01/app/oracle/product/10.2.0/db_1/lib/libskgxn2.so                               151     7.0k     1.1m
/lib64/libdl-2.12.so                                                               151     7.0k     1.1m
/lib64/ld-2.12.so                                                                  151     7.0k     1.1m
/lib64/libpthread-2.12.so                                                          151     7.0k     1.1m
/lib64/libm-2.12.so                                                                151     8.0k     1.2m
/lib64/libc-2.12.so                                                                151    14.0k     2.2m
/u01/app/oracle/product/10.2.0/db_1/lib/libdbcfg10.so                              151    15.0k     2.2m
/u01/app/oracle/product/10.2.0/db_1/lib/libocrb10.so                               151    22.0k     3.4m
/u01/app/oracle/product/10.2.0/db_1/lib/libskgxp10.so                              151    22.0k     3.4m
/u01/app/oracle/product/10.2.0/db_1/lib/libocr10.so                                151    34.0k     5.0m
/u01/app/oracle/product/10.2.0/db_1/lib/libocrutl10.so                             151    61.0k     9.0m
[stack]                                                                            151    97.0k    14.4m
/u01/app/oracle/product/10.2.0/db_1/lib/libhasgen10.so                             151   110.0k    16.3m
/u01/app/oracle/product/10.2.0/db_1/bin/oracle                                     151   222.0k    32.8m
<anonymous>                                                                        151   265.0k    39.2m
[heap]                                                                             151   488.0k    72.0m
/u01/app/oracle/product/10.2.0/db_1/lib/libnnz10.so                                151   640.0k    94.4m
/dev/zero                                                                          151   950.0k   140.1m
/u01/app/oracle/product/10.2.0/db_1/lib/libjox10.so                                151     1.5m   221.0m
/sysv94f021f8                                                                      151     5.8m   880.7m
---------------------------------------------------------------------------------------------------------
27                                                                                3941    10.2m     1.5g

--//pids表示查询的进程数量,它是将pss平均分摊到各个用户.
--//sysv94f021f8表示共享内存段.

# ipcs -m

------ shared memory segments --------
key        shmid      owner      perms      bytes      nattch     status
0x94f021f8 32768      oracle     640        1176502272 151
              
--//key=0x94f021f8,不过后面的pss如果计算的不是很清楚感觉应该是1176502272/1024/1024 = 1122m.难道不过全部加载吗?
--//nattch表示连接使用共享内存段的进程数.正好151可以与smem显示的pids对上.不再生产系统折腾,换测试机器测试.

2.测试环境:

# smem -tk -m -u oracle -p "oraclebook|ora_"
map                                                                               pids   avgpss      pss
/sysv00000000                                                                       26        0        0
/sysve8a8ec10                                                                       26        0        0
/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/hc_book.dat                           21        0        0
[vdso]                                                                              26        0        0
[vsyscall]                                                                          26        0        0
/lib64/libnss_dns-2.5.so                                                             1    24.0k    24.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnque11.so                           6     5.0k    30.0k
/lib64/libresolv-2.5.so                                                              1    35.0k    35.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libclsra11.so                         26     4.0k   104.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocrutl11.so                        26     4.0k   104.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxn2.so                          26     4.0k   104.0k
/usr/lib64/libaio.so.1.0.1                                                          26     4.0k   104.0k
/usr/lib64/libnuma.so.1                                                             26     4.0k   104.0k
/lib64/libdl-2.5.so                                                                 26     8.0k   208.0k
/lib64/libnsl-2.5.so                                                                26     8.0k   208.0k
/lib64/librt-2.5.so                                                                 26     8.0k   208.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libdbcfg11.so                         26     8.0k   208.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnfsodm11.so                        26     8.0k   208.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxp11.so                         26     8.0k   208.0k
/lib64/libnss_files-2.5.so                                                          26     8.0k   212.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocrb11.so                          26     9.0k   234.0k
/lib64/libpthread-2.5.so                                                            26     9.0k   237.0k
/lib64/ld-2.5.so                                                                    26    10.0k   260.0k
/lib64/libm-2.5.so                                                                  26    12.0k   328.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocr11.so                           26    14.0k   364.0k
/lib64/libc-2.5.so                                                                  26    22.0k   581.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libcell11.so                          26    69.0k     1.8m
[stack]                                                                             26    82.0k     2.1m
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libhasgen11.so                        26   162.0k     4.1m
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnnz11.so                           26   231.0k     5.9m
[heap]                                                                              26   418.0k    10.6m
/dev/zero                                                                           26   793.0k    20.1m
/u01/app/oracle/product/11.2.0.4/dbhome_1/bin/oracle                                26     1.3m    35.1m
<anonymous>                                                                         26     1.6m    42.4m
---------------------------------------------------------------------------------------------------------
34                                                                                 809     4.9m   126.1m
--//奇怪在共享内存段使用0.

# ipcs -m
------ shared memory segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 349011969  oracle    640        12582912   26
0x00000000 349044738  oracle    640        633339904  26
0xe8a8ec10 349077507  oracle    640        2097152    26

3.关闭hugepages看看.
vm.nr_hugepages = 0
vm.nr_overcommit_hugepages = 0

# grep -i page /proc/meminfo
anonpages:        249336 kb
pagetables:        18228 kb
anonhugepages:         0 kb
hugepages_total:       0
hugepages_free:        0
hugepages_rsvd:        0
hugepages_surp:        0
hugepagesize:       2048 kb

# ipcs -m

------ shared memory segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 349208577  oracle    640        12582912   22
0x00000000 349241346  oracle    640        633339904  22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0xe8a8ec10 349274115  oracle    640        2097152    22

# smem -tk -m -u oracle -p "oraclebook|ora_"
map                                                                               pids   avgpss      pss
/sysve8a8ec10                                                                       22        0        0
/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/hc_book.dat                           20        0        0
[vdso]                                                                              22        0        0
[vsyscall]                                                                          22        0        0
/lib64/libnss_dns-2.5.so                                                             1    24.0k    24.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnque11.so                           4     6.0k    24.0k
/lib64/libresolv-2.5.so                                                              1    35.0k    35.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libclsra11.so                         22     4.0k    88.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocrutl11.so                        22     4.0k    88.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxn2.so                          22     4.0k    88.0k
/usr/lib64/libaio.so.1.0.1                                                          22     4.0k    88.0k
/usr/lib64/libnuma.so.1                                                             22     4.0k    88.0k
/lib64/libdl-2.5.so                                                                 22     8.0k   176.0k
/lib64/libnsl-2.5.so                                                                22     8.0k   176.0k
/lib64/librt-2.5.so                                                                 22     8.0k   176.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libdbcfg11.so                         22     8.0k   176.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnfsodm11.so                        22     8.0k   176.0k
/lib64/libnss_files-2.5.so                                                          22     8.0k   179.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocrb11.so                          22     9.0k   198.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxp11.so                         22     9.0k   198.0k
/lib64/libpthread-2.5.so                                                            22     9.0k   200.0k
/lib64/ld-2.5.so                                                                    22    10.0k   220.0k
/lib64/libm-2.5.so                                                                  22    12.0k   281.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocr11.so                           22    14.0k   308.0k
/lib64/libc-2.5.so                                                                  22    22.0k   492.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libcell11.so                          22    70.0k     1.5m
[stack]                                                                             22    73.0k     1.6m
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libhasgen11.so                        22   166.0k     3.6m
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnnz11.so                           22   232.0k     5.0m
[heap]                                                                              22   420.0k     9.0m
/dev/zero                                                                           22   572.0k    12.3m
/u01/app/oracle/product/11.2.0.4/dbhome_1/bin/oracle                                22     1.6m    34.4m
<anonymous>                                                                         22     1.8m    38.6m
/sysv00000000                                                                       22     4.0m    88.6m
---------------------------------------------------------------------------------------------------------
34                                                                                 686     9.1m   198.0m

--///sysv00000000那行pss=88.6m.
sys@book> select /*+ full(a) */ count(*) from sh.sales a;
  count(*)
----------
    918843

[root@gxqyydg4 ip=100.78 /etc ] # smem -tk -m -u oracle -p "oraclebook|ora_"
map                                                                               pids   avgpss      pss
/sysve8a8ec10                                                                       22        0        0
/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/hc_book.dat                           20        0        0
[vdso]                                                                              22        0        0
[vsyscall]                                                                          22        0        0
/lib64/libnss_dns-2.5.so                                                             1    24.0k    24.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnque11.so                           4     6.0k    24.0k
/lib64/libresolv-2.5.so                                                              1    35.0k    35.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libclsra11.so                         22     4.0k    88.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocrutl11.so                        22     4.0k    88.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxn2.so                          22     4.0k    88.0k
/usr/lib64/libaio.so.1.0.1                                                          22     4.0k    88.0k
/usr/lib64/libnuma.so.1                                                             22     4.0k    88.0k
/lib64/libdl-2.5.so                                                                 22     8.0k   176.0k
/lib64/libnsl-2.5.so                                                                22     8.0k   176.0k
/lib64/librt-2.5.so                                                                 22     8.0k   176.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libdbcfg11.so                         22     8.0k   176.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnfsodm11.so                        22     8.0k   176.0k
/lib64/libnss_files-2.5.so                                                          22     8.0k   179.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocrb11.so                          22     9.0k   198.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libskgxp11.so                         22     9.0k   198.0k
/lib64/libpthread-2.5.so                                                            22     9.0k   200.0k
/lib64/ld-2.5.so                                                                    22    10.0k   220.0k
/lib64/libm-2.5.so                                                                  22    12.0k   282.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libocr11.so                           22    14.0k   308.0k
/lib64/libc-2.5.so                                                                  22    22.0k   492.0k
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libcell11.so                          22    70.0k     1.5m
[stack]                                                                             22    76.0k     1.6m
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libhasgen11.so                        22   166.0k     3.6m
/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libnnz11.so                           22   232.0k     5.0m
[heap]                                                                              22   420.0k     9.0m
/dev/zero                                                                           22   642.0k    13.8m
/u01/app/oracle/product/11.2.0.4/dbhome_1/bin/oracle                                22     1.6m    35.0m
<anonymous>                                                                         22     1.8m    38.7m
/sysv00000000                                                                       24     6.0m   143.7m
---------------------------------------------------------------------------------------------------------
34                                                                                 747    11.0m   262