Monitoring for Commons DBCP?

早过忘川 提交于 2020-01-01 05:20:15

问题


A huge webapp in my Tomcat sometimes starts using too many DBCP connections, leading to problems.
To investigate, I want to know precisely at each point in time what thread/method is holding a connection of the pool. Does not need to be real-time, post-mortem analysis is OK.

I have been looking for such a DBCP monitoring tool, in vain, so I am about to write mine.
(if there is any interest I can make it open source)

Here is my plan:

  • Modify PoolingDataSource.getConnection to log "DBCP+1 <thread-id>"
  • Modify DelegatingConnection.close to log "DBCP-1 <thread-id>"
  • Write a small script to generate this simple CSV for visualization:

QUESTION:
Am I missing some Commons-DBCP 1.4 concept that makes the idea invalid?
Or am I re-inventing the wheel?


回答1:


There was no such tool, so I created it:

https://github.com/nicolas-raoul/Commons-DBCP-monitoring

It monitors Commons DBCP usage (using/waiting for connection) and allows one to create such graphs:

I asked whether my assumptions are valid on the Commons DBCP mailing list.



来源:https://stackoverflow.com/questions/11663320/monitoring-for-commons-dbcp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!