使用springboot做了一个web小程序,只是实现了简单的查库功能。通过批处理命令
@echo off
echo "start-up......"
set Path=%path%;C:\Program Files\Java\jdk1.8.0_191\bin
set BASE_HOME=%cd%
java -Xms128m -Xmx128m -jar %BASE_HOME%\querytool.jar --spring.config.location=%BASE_HOME%\config\application.yml > %BASE_HOME%\log\batchLog%date:~0,4%%date:~5,2%%date:~8,2%.log
@pause
启动后没做任何操作,2个小时后cpu飙升到70%左右,如下图:
jstat -gcutil查看垃圾回收统计情况如下:
消耗大的线程如下(包含使用jmap -heap的信息):
"VM Periodic Task Thread" os_prio=2 tid=0x000000005412b000 nid=0x1504 waiting on condition
"NioBlockingSelector.BlockPoller-1" #18 daemon prio=5 os_prio=0 tid=0x0000000055403000 nid=0x18f0 runnable [0x000000005dbcf000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl.resetWakeupSocket0(Native Method)
at sun.nio.ch.WindowsSelectorImpl.resetWakeupSocket(Unknown Source)
- locked <0x00000000f9a57f00> (a java.lang.Object)
at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
- locked <0x00000000f98b2aa8> (a sun.nio.ch.Util$3)
- locked <0x00000000f98b2a98> (a java.util.Collections$UnmodifiableSet)
- locked <0x00000000f98b2948> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(Unknown Source)
at org.apache.tomcat.util.net.NioBlockingSelector$BlockPoller.run(NioBlockingSelector.java:298)
Locked ownable synchronizers:
- None
"http-nio-8081-ClientPoller-0" #29 daemon prio=5 os_prio=0 tid=0x0000000057c5b800 nid=0x894 runnable [0x000000005ea2f000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
- locked <0x00000000f9931328> (a sun.nio.ch.Util$3)
- locked <0x00000000f9931318> (a java.util.Collections$UnmodifiableSet)
- locked <0x00000000f9931158> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(Unknown Source)
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:825)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- None
"http-nio-8081-ClientPoller-1" #30 daemon prio=5 os_prio=0 tid=0x0000000057c5c800 nid=0x10a8 runnable [0x000000005ebaf000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(Unknown Source)
at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)
- locked <0x00000000f989d8d8> (a sun.nio.ch.Util$3)
- locked <0x00000000f989d8c8> (a java.util.Collections$UnmodifiableSet)
- locked <0x00000000f989d6a8> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(Unknown Source)
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:825)
at java.lang.Thread.run(Unknown Source)
Locked ownable synchronizers:
- None
// 此处是使用jamp -heap 的报错信息
Attaching to process ID 7156, please wait...
Error attaching to process: sun.jvm.hotspot.runtime.VMVersionMismatchException:
Supported versions are 25.191-b12. Target VM is 25.201-b09
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.runtime.VMVersionMis
matchException: Supported versions are 25.191-b12. Target VM is 25.201-b09
at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:435)
at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:305)
at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:140)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:185)
at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.tools.jmap.JMap.runTool(JMap.java:201)
at sun.tools.jmap.JMap.main(JMap.java:130)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported version
s are 25.191-b12. Target VM is 25.201-b09
at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:227)
at sun.jvm.hotspot.runtime.VM.<init>(VM.java:294)
at sun.jvm.hotspot.runtime.VM.initialize(VM.java:370)
at sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:431)
... 11 more
整个程序启动后就没有使用,cup消耗大的线程也是属于tomcat的nio,实在是找不到导致CPU飙升的原因,希望各位大大能提点下。