问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

db2内存不释放

发布网友 发布时间:2022-04-14 13:53

我来回答

3个回答

懂视网 时间:2022-04-14 18:14

最近在在做DB2的benchmark,发现数据库的内存占用特别高,因为是做benchmark测试,所以表并不多,并且主要是针对其中的一张表做测

最近在在做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 Memory is of size 196608 bytes
Catalog Cache Heap is of size 262144 bytes
Buffer Pool Heap (1) is of size 24465047552 bytes
Buffer Pool Heap (System 32k buffer pool) is of size 1835008 bytes
Buffer Pool Heap (System 16k buffer pool) is of size 1572864 bytes
Buffer Pool Heap (System 8k buffer pool) is of size 1441792 bytes
Buffer Pool Heap (System 4k buffer pool) is of size 1376256 bytes
Shared Sort Heap is of size 0 bytes
Lock Manager Heap is of size 3881172992 bytes
Database Heap is of size 94830592 bytes
Application Heap (47) is of size 131072 bytes
Application Heap (45) is of size 65536 bytes
Application Heap (44) is of size 65536 bytes
Application Heap (43) is of size 65536 bytes
Application Heap (42) is of size 65536 bytes
Application Heap (41) is of size 65536 bytes
Application Heap (40) is of size 65536 bytes
Application Heap (39) is of size 65536 bytes
Application Heap (38) is of size 65536 bytes
Application Heap (37) is of size 65536 bytes
Application Heap (36) is of size 65536 bytes
Application Heap (35) is of size 65536 bytes
Application Heap (34) is of size 65536 bytes
Application Heap (33) is of size 65536 bytes
Application Heap (32) is of size 65536 bytes
Application Heap (31) is of size 65536 bytes
Application Heap (30) is of size 65536 bytes
Application Heap (29) is of size 65536 bytes
Application Heap (28) is of size 65536 bytes
Application Heap (27) is of size 65536 bytes
Application Heap (26) is of size 65536 bytes
Application Heap (25) is of size 65536 bytes
Application Heap (24) is of size 65536 bytes
Application Heap (23) is of size 65536 bytes
Application Heap (22) is of size 65536 bytes
Application Heap (21) is of size 65536 bytes
Application Heap (20) is of size 65536 bytes
Application Heap (19) is of size 65536 bytes
Application Heap (18) is of size 65536 bytes
Application Heap (17) is of size 65536 bytes
Application Heap (16) is of size 65536 bytes
Application Heap (15) is of size 65536 bytes
Application Heap (14) is of size 65536 bytes
Application Heap (13) is of size 65536 bytes
Application Heap (12) is of size 65536 bytes
Application Heap (11) is of size 196608 bytes
Application Heap (10) is of size 65536 bytes
Application Heap (9) is of size 65536 bytes
Application Heap (8) is of size 65536 bytes
Application Heap (7) is of size 131072 bytes
Applications Shared Heap is of size 393216 bytes
Total: 28451340288 bytes

其中重点是“Memory for database: PA913”下的“Buffer Pool Heap (1) is of size 24465047552 bytes”,用了近25G的内存,由于我确定我的数据库中的数据量不是很大,所以减少数据库内存就是我的首选了。

查了一下资料,可以通过修改database_memory系统参数来设置数据库内存的使用。默认情况下database_memory的设置是AUTOMATIC,这里可以通过下面的命令来修改参数,,修改完后要重新启动db2

$ db2 update db cfg for using database_memory 8000000
$ db2stop force
$ db2start

数据库重启后,先用客户端连接一下数据库,然后再使用“db2mtrk -i -d -v”查看内存使用情况,就发现内存就会有明显的下降。用top查看结果也类似。

在真实的DB2使用情况下,修改这个值是需要慎重的,可以参考下面列出的参考资料。

本文永久更新链接地址:

热心网友 时间:2022-04-14 15:22

这个过程没有结束,因为这是主要的程序,总是重装杀毒软件看看,这可能是中毒量

热心网友 时间:2022-04-14 16:40

你把 数据库的 DB2 的缓存 相对设置小一些.
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
填地方专项志愿会影响本科二批录取吗? 地方专项计划成绩不好的可以报吗 国家专项地方专项影响本科填报吗 地方专项计划滑档影响本科录取吗 报地方专项计划会影响高考录取吗 地方专项计划影响后续录取吗 电脑最高配组装机配置组装电脑什么配置比较好 台式组装游戏电脑配置组装电脑什么配置比较好 打游戏主机电脑配置台式电脑主要是玩游戏什么配置最合适 组装高配置台式电脑组装电脑什么配置比较好 超级育儿师怎么收费的 红蓝黄绿哪个做灯笼好 超级育儿师仔仔是哪一集 超级育儿师詹红红妈妈强势,爸爸懦弱。孩子不爱说话,是哪一季? 宅院东墙挂红灯笼好吗? 超级育儿师串串哪一期 句子是举着灯笼好还是提着灯笼好? 超级育儿师哪个台播出,播出时间?求解答 年末最后一天家里挂灯笼好吗? 超级育儿师的节目结构 超级育儿师有看过的吗 户外安装什么材质的灯笼好 超级育儿师的介绍 羊皮灯笼好还是玻理灯笼好? 超级育儿师兰海老师的电话号码是多少? 有人来说说嘛灯笼好用嘛? 超级育儿师的原版节目 超级育儿师第三季全集孩子爱说谎话怎么办 春节什么样的灯笼好看 超级育儿师浩浩是第几期? 荣耀7换电池教程 荣耀7怎么换电池 荣耀7换个原装电池多少钱 我的额头和鼻子非常愿意出油怎么办? 钉钉里的向上科技怎么弄出来? 额头和鼻子出油怎么解决 为什么我的额头和鼻子很油 一个手机登两个怎么登? 脸上(额头,鼻子)特别油,怎么办?? 一个手机如何同时登录两个? 脸上油油的怎么办?就鼻子和额头,尤其鼻子.其他地方倒不会. 如何同时登两个 混合性皮肤,额头和鼻子出油怎么办? 我的鼻子和额头老油油的,我该怎么办啊? vivo手机怎么登录两个 电话号码存入mysql该选什么类型? 一个手机号怎么登录两个 怎么同时登陆两个 数据库表中电话号码字段用什么属性 数据库的表要保存一个11位电话号码,应该用什么型的?