Java Project Server CPU usage 100% workaround

Source: Internet
Author: User
Tags cpu usage

Server CPU Consumption 100%

Project on-line after a period of time, suddenly found that the CPU 8 logical core occupies 100%, the mood is very tense, and then on the Internet to find some solutions, specifically as follows:
1. Find out which processes are consuming CPU
Go to the server, top command to see that process 6633 takes up 800%
[email protected] ~]# top
2. Dump the stack of processes into the file so that the subsequent analysis
[email protected] ~]# jstack 23812 >> java.txt


3. See which threads in this process are consuming CPU
[email protected] ~]# top-p 23812-h
A large CPU-intensive thread, choose one of the highest, pid=15362
4. Then look at the dump out of the Java.txt log, there will be 23812 of the process below each thread of the stack information, but is the hexadecimal display, so first convert 5159 to 16 binary
[email protected] ~]# printf%0x 15362
[Email protected] ~]# 3C02
5. Find the PID=3C02 thread in the CPU log

[email protected] ~]# VI java.txt

6. Reasons for Analysis


[[email protected] ~]# grep "3C02" Java.txt

"JS executor for [email protected]" #76858 daemon prio=5 os_prio=0 tid=0x00007f390000b800 nid=0x3c02 runnable [0x00007f3ae 13DB000]

"JS executor for [email protected]" #76858 daemon prio=5 os_prio=0 tid=0x00007f390000b800 nid=0x3c02 runnable [0x00007f3ae 13DB000]

"JS executor for [email protected]" #76858 daemon prio=5 os_prio=0 tid=0x00007f390000b800 nid=0x3c02 Runnab

Java.lang.Thread.State:RUNNABLE

At Java.util.arraylist.<init> (arraylist.java:177)

At Com.gargoylesoftware.htmlunit.html.HtmlPage.safeGetAttributeListeners (htmlpage.java:2222)

-Locked <0x00000005cd622798> (a java.lang.String)

At com.gargoylesoftware.htmlunit.html.HtmlPage.fireHtmlAttributeReplaced (htmlpage.java:2198)

At Com.gargoylesoftware.htmlunit.html.HtmlElement.setAttributeNS (htmlelement.java:213)

At Com.gargoylesoftware.htmlunit.html.DomElement.setAttribute (domelement.java:296)

At Com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.writeToElement ( cssstyledeclaration.java:652)

At Com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.replaceStyleAttribute ( cssstyledeclaration.java:576)

At Com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.setStyleAttribute ( CSSSTYLEDECLARATION.JAVA:550)

At Com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.setZIndex (Cssstyledeclaration.java : 3956)

At Sun.reflect.GeneratedMethodAccessor135.invoke (Unknown Source)

At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43)

At Java.lang.reflect.Method.invoke (method.java:497)

At Net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke (memberbox.java:120)

At Net.sourceforge.htmlunit.corejs.javascript.scriptableobject$getterslot.setvalue (ScriptableObject.java:295)

At Net.sourceforge.htmlunit.corejs.javascript.scriptableobject$relinkedslot.setvalue (ScriptableObject.java:368)

At Net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.putImpl (scriptableobject.java:2796)

At Net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.put (scriptableobject.java:521)

At Com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.put (cssstyledeclaration.java:2407)

At Net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.putProperty (scriptableobject.java:2479)

At Net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.setObjectProp (scriptruntime.java:1574)

At Net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.setObjectProp (scriptruntime.java:1569)

At Net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop (interpreter.java:1253)

At Net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret (interpreter.java:798)

At Net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call (interpretedfunction.java:105)

At Net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall (contextfactory.java:411)

At Com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall (htmlunitcontextfactory.java:309)

At Net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall (scriptruntime.java:3057)

At Net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec (interpretedfunction.java:115)

At Com.gargoylesoftware.htmlunit.javascript.javascriptengine$3.dorun (javascriptengine.java:566)

At Com.gargoylesoftware.htmlunit.javascript.javascriptengine$htmlunitcontextaction.run (JavaScriptEngine.java : 674)

-Locked <0x00000005cd2f5a08> (a com.gargoylesoftware.htmlunit.html.HtmlPage)

At Net.sourceforge.htmlunit.corejs.javascript.Context.call (context.java:620)

At Net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call (contextfactory.java:513)

At Com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute (javascriptengine.java:575)

At Com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute (javascriptengine.java:550)

At Com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible (htmlpage.java:971)

At Com.gargoylesoftware.htmlunit.javascript.background.JavaScriptStringJob.runJavaScript ( JAVASCRIPTSTRINGJOB.JAVA:50)

At Com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.run (Javascriptexecutionjob.java : 102)

At Com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob ( javascriptjobmanagerimpl.java:328)

At Com.gargoylesoftware.htmlunit.javascript.background.DefaultJavaScriptExecutor.run ( defaultjavascriptexecutor.java:162)

At Java.lang.Thread.run (thread.java:745)

Find the problem and let Java development troubleshoot

This article is from the "10931853" blog, please be sure to keep this source http://wujianwei.blog.51cto.com/10931853/1964359

Java Project Server CPU usage 100% workaround

Related Article

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.