If you have a Java application that is consuming CPU when it isn't doing anything, how do you determine what it is doing?

后端 未结 8 1949
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 19:44

I am calling a vendor\'s Java API, and on some servers it appears that the JVM goes into a low priority polling loop after logging into the API (CPU at 100% usage). The sam

8条回答
  •  既然无缘
    2021-01-01 20:38

    JRockit Mission Control Latency Analyzer.

    The Latency Analyzer that comes with JRockit shows you what the JVM is "doing" when it's not doing anything. In the latest version you can see latencies for:

    • Java wait/blocked/sleep/parked.
    • File I/O
    • Network I/O
    • Memory allocation
    • GC pauses
    • JVM latencies, e.g code generation and class loading
    • Thread suspension

    The tool will give you the stack trace when the latency occurred. You can view the latency data in many different ways (aggregated traces, as a histogram, in a thread graph etc.). The tool also allows you to see transitions between threads, for instance when one thread notifies another.

    latency analyzer http://blogs.oracle.com/hirt/WindowsLiveWriter/The.0LatencyAnalyserMigratedfromtheoldBE_7246/latency_graph_2.png

    The overhead is negligible and unlike many other tools it can be used in a production environment. This blog post gives you a brief introduction and the program can be downloaded here.

    It's free to use for development!

提交回复
热议问题