Troubleshoot High CPU Usage on Windows Server
<p>We have J2EE based web application.  Intermittently we are facing high CPU usage (80-90%) on our production environment. 
We are unable to replicate it on our QA environment. </p>

<p>Production Environment: Windows 2012 Server (64 bit), JDK 1.8 (64 bit) </p>

<p>For troubleshooting we have taken thread dump. 
It shows total 215 threads.</p>

<pre><code>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
</code></pre>

<p>How can we find which threads are causing high CPU usage?</p>

<h1>Thread Dump</h1>

<blockquote>
  <p>2016-03-01 11:07:52 Full thread dump Java HotSpot(TM) 64-Bit Server VM
  (25.5-b02 mixed mode):</p>
  
  <p>"Thread-739969" - Thread t@807668    java.lang.Thread.State: WAITING
    at java.lang.Object.wait(Native Method)
    - waiting on &lt;229fc226> (a 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)</p>
  
  <p>Locked ownable synchronizers:
    - None</p>
  
  <p>"Thread-739968" - Thread t@807667    java.lang.Thread.State: WAITING
    at java.lang.Object.wait(Native Method)
    - waiting on &lt;5a578345> (a 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)</p>
  
  <p>Locked ownable synchronizers:
    - None</p>
  
  <p>"Thread-739963" - Thread t@807662    java.lang.Thread.State: WAITING
    at java.lang.Object.wait(Native Method)
    - waiting on &lt;20851ef7> (a 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)</p>
  
  <p>Locked ownable synchronizers:
    - None</p>
  
  <p>"Thread-739962" - Thread t@807661    java.lang.Thread.State: WAITING
    at java.lang.Object.wait(Native Method)
    - waiting on &lt;35061b89> (a 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)</p>
  
  <p>Locked ownable synchronizers:
    - None</p>
  
  <p>"Thread-739960" - Thread t@807659    java.lang.Thread.State: WAITING
    at java.lang.Object.wait(Native Method)
    - waiting on &lt;3491a931> (a 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)</p>
  
  <p>Locked ownable synchronizers:
    - None</p>
  
  <p>"Thread-739959" - Thread t@807658    java.lang.Thread.State: WAITING
    at java.lang.Object.wait(Native Method)
    - waiting on &lt;6395c27d> (a 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)</p>
  
  <p>Locked ownable synchronizers:
    - None</p>
  
  <p>"httpShardExecutor-3-thread-57429-processing-{core=actionscomments,
  replica=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,
  collection=actionscomments,
  ShardRequest.urlList=[<a href="http:////s1r1.asite.com:8983//solr//actionscomments" rel="nofollow">http:////s1r1.asite.com:8983//solr//actionscomments</a>,
  <a href="http:////s1.asite.com:8983//solr//actionscomments]" rel="nofollow">http:////s1.asite.com:8983//solr//actionscomments]</a>}" - Thread 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)
    at
  org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:84)
    at
  org.apache.http.impl.io.SocketInputBuffer.isDataAvailable(SocketInputBuffer.java:95)
    at
  org.apache.http.impl.AbstractHttpClientConnection.isStale(AbstractHttpClientConnection.java:310)
    at
  org.apache.http.impl.conn.ManagedClientConnectionImpl.isStale(ManagedClientConnectionImpl.java:158)
    at
  org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:433)
    at
  org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
    at
  org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at
  org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
    at
  org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at
  org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:466)
    at
  org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:235)
    at
  org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:227)
    at
  org.apache.solr.client.solrj.impl.LBHttpSolrClient.doRequest(LBHttpSolrClient.java:376)
    at
  org.apache.solr.client.solrj.impl.LBHttpSolrClient.request(LBHttpSolrClient.java:328)
    at
  org.apache.solr.handler.component.HttpShardHandlerFactory.makeLoadBalancedRequest(HttpShardHandlerFactory.java:246)
    at
  org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:221)
    at
  org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:183)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at
  java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at
  org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$1.run(ExecutorUtil.java:148)
    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)</p>
  
  <p>Locked ownable synchronizers:
    - locked  (a java.util.concurrent.ThreadPoolExecutor$Worker)</p>
</blockquote>