DB2 performance issue due to the high disk write into temp table space

本文诊断了一个运行缓慢的应用程序问题,发现其原因是由于大量插入操作导致缓冲池资源紧张,进而引发锁等待和I/O瓶颈。通过调整程序代码和扩大缓冲池容量解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

An application ran slower than before and the application only invoked a procedure.

After checking I found:

  • One section about inserting data into temp table(activity_ID 2) ran more than 50 times and each time of running took more than 120s, even, the largest run time would be about 350s. The reason of more running times is the procedure code is changed and the insert statement is generated by while loop. The updated while condition generated more insert statements than before. I got all of the information by checking the procedure create time and the code management tool P4V.
  • There are large number of latch waits during the procedure running.

Running time information:
run time information

The latch wait information:
latch wait information

Latch name is SQLO_LT_SQLB_DIRTY_LIST_SET__appendLatch. I guess it is about operating the dirty page list in a buffer pool. I cannot get any information useful about this latch in google. Latch holder EDU name is db2pfchr, which is about the prefetcher. So the whole logic would be:

  • Large number of inserting operation increased the dirty pages in the buffer pool.
  • Prefetcher read pages into buffer pool.
  • Buffer pool page was not enough.
  • Dirty page cleaning up was triggered by the prefecher and the latch is hold by this EDU.
  • Other applications inserted or read data into the buffer pool but found no page left either, dirty page cleaning up was also triggered but the dirty list latch was already hold by prefetcher. The latch wait occurred.

Based on all of above and the statement is about inserting date into temp table, I guessed there may be I/O issue about the temp table space and its buffer pool.

Buffer pool information for user temp table space:

  • Async write occupied only 19.87%.
  • Async write time is 27.27ms.
    Buffer pool information for temp table space

User temp table space information:

  • Average write time is 43.62ms whereas the average read time is only 0.13ms.
    在这里插入图片描述

So, the final reason includes:

  • too many inserting operation makes the buffer pool full
  • buffer pool is too small to hold all of the pages .

For the first reason, the procedure code should be changed and for the second reason, the buffer pool should be extended.

Questions:

  • There may be any I/O error for the disk? No. because other table spaces share the same paths as the temp table spaces and they did not meet any I/O issue.
  • Why did I decide to check the procedure creating time? I forget but when I was handling this issue some logic made me check that. Maybe I thought there is no problem for this procedure before so I guess if there is any change about the procedure.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值