Which threads the Java process consumes CPU high analysis

Source: Internet
Author: User
Tags benchmark

Take the hbase benchmark to analyze which threads use the higher CPU, the environment is Linux, the benchmark command:

HBase org.apache.hadoop.hbase.PerformanceEvaluation--rows=500000--nomapred--presplit=5--writetowal=true Randomwrite 5

First look at the process and thread ID that consumes the highest CPU and execute the command:

[Email protected] logs]$ PS Hh-eo pid,tid,pcpu | Sort-nk3 |tail

12404 12429 0.6
13230 13291 0.6
14117 14178 1.7
14117 14172 1.9
14117 14294 4.6
14117 14295 4.6
14117 14296 4.6
14117 14293 4.7
14117 14297 4.7
14117 14173 8.0

Gets thread 142,976, followed by a jstack inside

[[email protected] logs]$ printf "%x\n" 14297
37d9

Then according to Jstack View CPU usage as 4.7% thread id14297, process id14117, get jstack information:

[Email protected] logs]$ Jstack 14117 > Jstack.log

Then VI Jstack.log, looking for threads with thread ID 37D9

"TestClient-4" #40 prio=5 os_prio=0 tid=0x00007fefc0539000 nid=0x37d9 runnable [0x00007fefa73f9000] Java.lang.Thread.State:RUNNABLE at Org.apache.hadoop.hbase.util.bytes$lexicograph Icalcomparerholder$unsafecomparer.compareto (bytes.java:1276) at Org.apache.hadoop.hbase.util.Bytes.compareTo ( bytes.java:1187) at Org.apache.hadoop.hbase.util.bytes$bytearraycomparator.compare (Bytes.java:153) at Org.ap Ache.hadoop.hbase.util.bytes$bytearraycomparator.compare (bytes.java:142) at JAVA.UTIL.CONCURRENT.CONCURRENTSKIPLISTMAP.CPR (concurrentskiplistmap.java:655) at Java.util.concurrent.ConcurrentSkipListMap.findNear (concurrentskiplistmap.java:1247) at Java.util.concurrent.ConcurrentSkipListMap.getNear (concurrentskiplistmap.java:1268) at Java.util.concurrent.ConcurrentSkipListMap.floorEntry (concurrentskiplistmap.java:2153) at Org.apache.hadoop.hbase.client.MetaCache.getCachedLocation (metacache.java:74) at Org.apache.hadoop.hbase.client.connectionmanager$hconnectionimplementation.getcachedlocation (Connectionmanager.java:1313) at org.apache.hadoop.hbase.client.connectionmanager$ Hconnectionimplementation.locateregioninmeta (connectionmanager.java:1157) at Org.apache.hadoop.hbase.client.connectionmanager$hconnectionimplementation.locateregion (ConnectionManager.java : 1109) at Org.apache.hadoop.hbase.client.AsyncProcess.submit (asyncprocess.java:369) at Org.apache.hadoop.hba Se.client.AsyncProcess.submit (asyncprocess.java:320) at Org.apache.hadoop.hbase.client.BufferedMutatorImpl.backgroundFlushCommits (bufferedmutatorimpl.java:198) at Org.apache.hadoop.hbase.client.BufferedMutatorImpl.doMutate (bufferedmutatorimpl.java:141) at Org.apache.hadoop.hbase.client.BufferedMutatorImpl.mutate (bufferedmutatorimpl.java:98)-Locked < 0x00000000c6ccc800> (a org.apache.hadoop.hbase.client.BufferedMutatorImpl) at Org.apache.hadoop.hbase.Performan Ceevaluation$randomwritetest.testrow (performanceevaluation.java:1384) at org.apache.hAdoop.hbase.performanceevaluation$test.testtimed (performanceevaluation.java:1071) at Org.apache.hadoop.hbase.performanceevaluation$test.test (performanceevaluation.java:1053) at Org.apache.hadoop.hbase.PerformanceEvaluation.runOneClient (performanceevaluation.java:1612) at Org.apache.hadoop.hbase.performanceevaluation$1.call (performanceevaluation.java:410) at Org.apache.hadoop.hbase.performanceevaluation$1.call (performanceevaluation.java:405) at Java.util.concurrent.FutureTask.run (futuretask.java:266) at Java.util.concurrent.ThreadPoolExecutor.runWorker (        threadpoolexecutor.java:1142) at Java.util.concurrent.threadpoolexecutor$worker.run (ThreadPoolExecutor.java:617) At Java.lang.Thread.run (thread.java:745)

You can see that this thread is performing a put operation, which is a client in the benchmark that meets our expectations.

Which threads the Java process consumes CPU high analysis

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.