Tools to monitor java thread execution

后端 未结 6 699
太阳男子
太阳男子 2021-02-06 11:14

I\'ve a java web application running on an Tomcat server(Linux). In the production environment I\'m facing some performance issue. At random intervals the jsvc process on which

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-06 12:01

    One relatively easy way to do this (which may or may not work for your case -- depends on how long the behavior occurs):

    When your app exhibits the behavior you want to debug (in this case, 90-100% CPU use) use jstack on the process ID:

    http://download.oracle.com/javase/6/docs/technotes/tools/share/jstack.html

    to examine what threads are running and in what methods they occur. If you do that a few times, it may be relatively easy to spot the culprit call chain. You can then just debug the entrance to that chain.

    It's not necessarily the best or most elegant method, but it's very easy to do and it may be all you need. I would start there. It's akin to the "printf is the best debugger I've ever used" philosophy.

提交回复
热议问题