解决Windows Server上的高CPU使用率

时间:2016-03-02 09:03:18

标签: java performance cpu

我们有基于J2EE的Web应用程序。我们间歇性地在生产环境中面临高CPU使用率(80-90%)。 我们无法在QA环境中复制它。

生产环境:Windows 2012 Server(64位),JDK 1.8(64位)

为了排除故障,我们进行了线程转储。 它显示总共215个线程。

111 threads are in WAITING status
34 threads are in RUNNABLE status
67 threads are in TIMED_WAITING status
3 threads are in BLOCKED status

我们如何找到导致高CPU使用率的线程?

线程转储

  

2016-03-01 11:07:52完全线程转储Java HotSpot(TM)64位服务器VM   (25.5-b02混合模式):

     

"螺纹739969" - Thread t @ 807668 java.lang.Thread.State:WAITING     at java.lang.Object.wait(Native Method)      - 等待< 229fc226> (一个org.apache.solr.util.ConcurrentLRUCache $ CleanupThread)at   java.lang.Object.wait(Object.java:502)at   org.apache.solr.util.ConcurrentLRUCache $ CleanupThread.run(ConcurrentLRUCache.java:604)

     

锁定可拥有的同步器:      - 没有

     

"螺纹739968" - Thread t @ 807667 java.lang.Thread.State:WAITING     at java.lang.Object.wait(Native Method)      - 等待< 5a578345> (一个org.apache.solr.util.ConcurrentLRUCache $ CleanupThread)at   java.lang.Object.wait(Object.java:502)at   org.apache.solr.util.ConcurrentLRUCache $ CleanupThread.run(ConcurrentLRUCache.java:604)

     

锁定可拥有的同步器:      - 没有

     

"螺纹739963" - Thread t @ 807662 java.lang.Thread.State:WAITING     at java.lang.Object.wait(Native Method)      - 等待< 20851ef7> (一个org.apache.solr.util.ConcurrentLRUCache $ CleanupThread)at   java.lang.Object.wait(Object.java:502)at   org.apache.solr.util.ConcurrentLRUCache $ CleanupThread.run(ConcurrentLRUCache.java:604)

     

锁定可拥有的同步器:      - 没有

     

"螺纹739962" - Thread t @ 807661 java.lang.Thread.State:WAITING     at java.lang.Object.wait(Native Method)      - 等待< 35061b89> (一个org.apache.solr.util.ConcurrentLRUCache $ CleanupThread)at   java.lang.Object.wait(Object.java:502)at   org.apache.solr.util.ConcurrentLRUCache $ CleanupThread.run(ConcurrentLRUCache.java:604)

     

锁定可拥有的同步器:      - 没有

     

"螺纹739960" - Thread t @ 807659 java.lang.Thread.State:WAITING     at java.lang.Object.wait(Native Method)      - 等待< 3491a931> (一个org.apache.solr.util.ConcurrentLRUCache $ CleanupThread)at   java.lang.Object.wait(Object.java:502)at   org.apache.solr.util.ConcurrentLRUCache $ CleanupThread.run(ConcurrentLRUCache.java:604)

     

锁定可拥有的同步器:      - 没有

     

"螺纹739959" - Thread t @ 807658 java.lang.Thread.State:WAITING     at java.lang.Object.wait(Native Method)      - 等待< 6395c27d> (一个org.apache.solr.util.ConcurrentLRUCache $ CleanupThread)at   java.lang.Object.wait(Object.java:502)at   org.apache.solr.util.ConcurrentLRUCache $ CleanupThread.run(ConcurrentLRUCache.java:604)

     

锁定可拥有的同步器:      - 没有

     

" httpShardExecutor -3-线程57429-处理 - {核心= actionscomments,   复制品= core_node1,   ShardRequest.shards = s1.asite.com:8983 // // Solr的actionscomments | s1r1.asite.com:8983个// // Solr的actionscomments,   node_name = 10.120.112.31:8983_solr,shard = shard1,   收集= actionscomments,   ShardRequest.urlList = [http:////s1r1.asite.com:8983//solr//actionscomments,   http:////s1.asite.com:8983//solr//actionscomments]}" - 线程t @ 807648   java.lang.Thread.State:RUNNABLE at   java.net.SocketInputStream.socketRead0(Native Method)at   java.net.SocketInputStream.read(SocketInputStream.java:150)at   java.net.SocketInputStream.read(SocketInputStream.java:121)at   org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:160)     在   org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:84)     在   org.apache.http.impl.io.SocketInputBuffer.isDataAvailable(SocketInputBuffer.java:95)     在   org.apache.http.impl.AbstractHttpClientConnection.isStale(AbstractHttpClientConnection.java:310)     在   org.apache.http.impl.conn.ManagedClientConnectionImpl.isStale(ManagedClientConnectionImpl.java:158)     在   org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:433)     在   org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)     在   org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)     在   org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)     在   org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)     在   org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:466)     在   org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:235)     在   org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:227)     在   org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:376)     在   org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:328)     在   org.apache.solr.handler.component.HttpShardHandlerFactory.makeLoadBalancedRequest(HttpShardHandlerFactory.java:246)     在   org.apache.solr.handler.component.HttpShardHandler $ 1.call(HttpShardHandler.java:221)     在   org.apache.solr.handler.component.HttpShardHandler $ 1.call(HttpShardHandler.java:183)     在java.util.concurrent.FutureTask.run(FutureTask.java:266)at   java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)     在java.util.concurrent.FutureTask.run(FutureTask.java:266)at   org.apache.solr.common.util.ExecutorUtil $ MDCAwareThreadPoolExecutor $ 1.run(ExecutorUtil.java:148)     在   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)     在java.lang.Thread.run(Thread.java:745)

     

锁定可拥有的同步器:      - locked(java.util.concurrent.ThreadPoolExecutor $ Worker)

3 个答案:

答案 0 :(得分:2)

使用visualvm标识消耗CPU的线程。有关解释线程转储的好文章可以在DZone上找到:how-analyze-java-thread-dumps

这应该允许您识别线程,也许您已经可以直接识别问题本身。

答案 1 :(得分:0)

尝试Jconsole(TopThread插件)或visulavm(HotThread Detector插件),这些插件可以解释您要查找的内容。还请检查this问题。

答案 2 :(得分:0)

Process Explorer是调试Windows性能问题的强大工具。它可以检查死锁线程或内存问题。