JPS See which threads in the Java process are consuming system resources

Source: Internet
Author: User

JPS or Ps-ef|grep Java can see which Java processes, this needless to say.
But it is worth mentioning that the JPS command is dependent on some files in/tmp. Some operating systems periodically clean up files in/tmp, resulting in JPS not seeing the actual Java process. But the same is true for Jstat, Jstack and so on, so when the JPS is out of the process, these commands are useless. Not within the scope of our discussion.

Top-p $pid-H plus-H This parameter lists which threads are listed. This allows you to see which thread ID consumes the most system resources.
The thread ID you see is a 10 binary number.

Jstack $pid can print out the stack condition for the Java process.

The thread ID seen by the front top command is converted to a 16 binary display, which can be found in the results of the jstack.

For example, the following:
"Pool-2-thread-1" prio=10 tid=0x000000004c9b2000 nid=0x11f4 waiting on condition [0x0000000042f36000]
Java.lang.Thread.State:WAITING (parking)
At Sun.misc.Unsafe.park (Native Method)
-Parking to wait for <0x0000000580089050> (a java.util.concurrent.locks.abstractqueuedsynchronizer$ Conditionobject)
At Java.util.concurrent.locks.LockSupport.park (locksupport.java:158)
At Java.util.concurrent.locks.abstractqueuedsynchronizer$conditionobject.await (AbstractQueuedSynchronizer.java : 1987)
At Java.util.concurrent.LinkedBlockingQueue.take (linkedblockingqueue.java:399)
At Java.util.concurrent.ThreadPoolExecutor.getTask (threadpoolexecutor.java:947)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:907)
At Java.lang.Thread.run (thread.java:662)


Where the "Nid=0x11f4", 11F4 is the thread ID of the 16 binary representation

JPS See which threads in the Java process are consuming system resources

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.