最近在在做DB2的benchmark,发现数据库的内存占用特别高,因为是做benchmark测试,所以表并不多,并且主要是针对其中的一张表做测试,当这张表的数据快到1亿的时候,用top查询系统状态如下
# top
top - 20:06:34 up 5 days, 22:20, 12 users, load average: 18.53, 6.57, 3.19
...
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
32458 db2inst 20 0 42.3g 27g 27g S 63.7 44.3 0:27.13 db2sysc 0
...
其中db2sync进程用了27G的内存,从而导致系统物理内存几乎被用光并且系统也变的非常慢。
使用db2mtrk命令来查看db2的内存使用情况,如下:
# db2mtrk -i -d -v
Tracking Memory on: 2014/06/22 at 21:50:19
Memory for instance
Other Memory is of size 63111168 bytes
FCMBP Heap is of size 851968 bytes
Database Monitor Heap is of size 983040 bytes
Total: 64946176 bytes
Memory for database: PA913
Backup/Restore/Util Heap is of size 65536 bytes
Package Cache is of size 262144 bytes
Other M