银行 数据库

关于OS的内存和DB的内存之间的关系

可以看到内存使用了8G,总共也才8G多,但是底下的进程最大的一个才占用了12%,为什么呢? 显示全部

$7DA70157026EC4D6.jpg



可以看到内存使用了8G,总共也才8G多,但是底下的进程最大的一个才占用了12%,为什么呢? 收起
参与30

查看其它 28 个回答weiruan85 的回答

weiruan85 weiruan85 数据库管理员 ibm
数据库实际使用的内存应该是yong db2mrtk -i -d -v 来看
在节点1上
db2inpe@dmsrvr:~> db2mtrk -i -d -v
Tracking Memory on: 2012/03/15 at 04:29:44

Memory for instance

   Other Memory is of size 34799616 bytes
   Database Monitor Heap is of size 327680 bytes
   FCMBP Heap is of size 22413312 bytes
   Total: 57540608 bytes

Memory for database: TEST

   Backup/Restore/Util Heap is of size 65536 bytes
   Package Cache is of size 524288 bytes
   Other Memory is of size 131072 bytes
   Catalog Cache Heap is of size 262144 bytes
   Buffer Pool Heap (2) is of size 33226752 bytes
   Buffer Pool Heap (1) is of size 4521984 bytes
   Buffer Pool Heap (System 32k buffer pool) is of size 851968 bytes
   Buffer Pool Heap (System 16k buffer pool) is of size 589824 bytes
   Buffer Pool Heap (System 8k buffer pool) is of size 458752 bytes
   Buffer Pool Heap (System 4k buffer pool) is of size 393216 bytes
   Shared Sort Heap is of size 0 bytes
   Lock Manager Heap is of size 26476544 bytes
   Database Heap is of size 14876672 bytes
   Application Heap (3744) is of size 196608 bytes
   Application Heap (68077) is of size 65536 bytes
   Application Heap (3749) is of size 65536 bytes
   Application Heap (3746) is of size 65536 bytes
   Application Heap (68068) is of size 65536 bytes
   Application Heap (68067) is of size 65536 bytes
   Applications Shared Heap is of size 327680 bytes
   Total: 83230720 bytes


在节点0上

db2inpe@dmsrvr:~/sqllib/db2dump> db2mtrk -i -d -v
Tracking Memory on: 2012/03/15 at 04:41:17

Memory for instance

   Other Memory is of size 35258368 bytes
   Database Monitor Heap is of size 327680 bytes
   FCMBP Heap is of size 22413312 bytes
   Total: 57999360 bytes

Memory for database: TEST

   Backup/Restore/Util Heap is of size 65536 bytes
   Package Cache is of size 2162688 bytes
   Other Memory is of size 131072 bytes
   Catalog Cache Heap is of size 524288 bytes
   Buffer Pool Heap (2) is of size 33226752 bytes
   Buffer Pool Heap (1) is of size 4521984 bytes
   Buffer Pool Heap (System 32k buffer pool) is of size 851968 bytes
   Buffer Pool Heap (System 16k buffer pool) is of size 589824 bytes
   Buffer Pool Heap (System 8k buffer pool) is of size 458752 bytes
   Buffer Pool Heap (System 4k buffer pool) is of size 393216 bytes
   Shared Sort Heap is of size 131072 bytes
   Lock Manager Heap is of size 26476544 bytes
   Database Heap is of size 14876672 bytes
   Application Heap (68077) is of size 65536 bytes
   Application Heap (3749) is of size 65536 bytes
   Application Heap (3747) is of size 65536 bytes
   Application Heap (68067) is of size 65536 bytes
   Application Heap (3746) is of size 65536 bytes
   Application Heap (3745) is of size 65536 bytes
   Application Heap (3744) is of size 131072 bytes
   Application Heap (3743) is of size 65536 bytes
   Application Heap (3742) is of size 65536 bytes
   Applications Shared Heap is of size 720896 bytes
   Total: 85786624 bytes



57999360+85786624 =143785984


关于ps aux 应该跟dbpmem对应着看。
db2inpe@dmsrvr:~/sqllib/db2dump> ps aux|head
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
db2inpe@dmsrvr:~/sqllib/db2dump> ps aux |grep db2sysc
db2inpe  23934  0.0 22.4 667520 227900 ?       Sl   Mar12   3:53 db2sysc 0
db2inpe  23937  0.0 21.6 605008 219492 ?       Sl   Mar12   3:36 db2sysc 1


Database Partition Memory Controller Statistics

Controller Automatic: Y
Memory Limit:         380564 KB
Current usage:        309792 KB
HWM usage:            313824 KB
Cached memory:        69760 KB

309792 - 69760 = 240032 相减才是已经分配的的实际内存,应该不是使用到的内存

而top  里边看到的内存跟实际的不符是因为有cache 和buffer ,free -m 看一下就知道了
政府机关 · 2012-03-13
浏览652

回答者

weiruan85
weiruan85 0 0 3
数据库管理员 ibm
评论2666

weiruan85 最近回答过的问题

回答状态

  • 发布时间:2012-03-13
  • 关注会员:1 人
  • 回答浏览:652
  • X社区推广