首页 > 解决方案 > 为什么 java.exe 由于“org.xnio.nio”线程而消耗更多 CPU?

问题描述

我们正在运行带有 JDK 1.8 版本的 WildFly 12。由于 java.exe 的高 CPU 使用率(90% 以上),我们的 Web 应用程序面临门户关闭/缓慢问题。然后,我们使用 JStack 进行了线程转储,大多数高 CPU 线程都指向“org.xnio.nio”

门户在HTTPS中运行

CPU: 8核

总内存: 24 GB

分配的 JVM 内存:从 1 GB(最小)到 5 GB(最大)

进行线程转储时占用的 JVM 内存: 4 GB

数据库在单独的机器上

以下是线程转储结果(高 CPU 线程):

"default I/O-1" #95 prio=5 os_prio=0 tid=0x00000000260bf800 nid=0x1988 runnable [0x000000002e49f000]
   java.lang.Thread.State: RUNNABLE
    at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:147)
    at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
    at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59)
    at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
    at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
    at io.undertow.conduits.ReadTimeoutStreamSourceConduit$2.readReady(ReadTimeoutStreamSourceConduit.java:89)
    at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1145)
    at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
    at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)

"default I/O-13" #108 prio=5 os_prio=0 tid=0x0000000022186000 nid=0x2310 runnable [0x000000002f09f000]
   java.lang.Thread.State: RUNNABLE
    at java.lang.Object.notifyAll(Native Method)
    at sun.nio.ch.WindowsSelectorImpl$StartLock.startThreads(WindowsSelectorImpl.java:189)
    - locked <0x00000006618ae440> (a sun.nio.ch.WindowsSelectorImpl$StartLock)
    at sun.nio.ch.WindowsSelectorImpl$StartLock.access$300(WindowsSelectorImpl.java:181)
    at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:153)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
    - locked <0x000000066508ea18> (a sun.nio.ch.Util$3)
    - locked <0x000000066508ea08> (a java.util.Collections$UnmodifiableSet)
    - locked <0x0000000665082b98> (a sun.nio.ch.WindowsSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
    at org.xnio.nio.WorkerThread.run(WorkerThread.java:551)


"default I/O-13" #108 prio=5 os_prio=0 tid=0x0000000022186000 nid=0x2310 runnable [0x000000002f09e000]
   java.lang.Thread.State: RUNNABLE
    at java.util.AbstractCollection.toArray(AbstractCollection.java:183)
    at sun.nio.ch.Util$3.toArray(Util.java:322)
    at org.xnio.nio.WorkerThread.run(WorkerThread.java:570)
    - locked <0x000000066508ea18> (a sun.nio.ch.Util$3)
    - locked <0x0000000665082b98> (a sun.nio.ch.WindowsSelectorImpl)    

"default I/O-5" #100 prio=5 os_prio=0 tid=0x00000000260c0000 nid=0x858 runnable [0x000000002e89e000]
   java.lang.Thread.State: RUNNABLE
    at org.xnio.nio.WorkerThread.run(WorkerThread.java:480) 

该问题发生 (2 - 5) 天一次。

提前致谢

标签: javamultithreadingjakarta-eeweb-applicationswildfly-12

解决方案


推荐阅读