alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.07k stars 12.81k forks source link

nacos leads to high CPU usage #1605

Closed hyw520110 closed 5 years ago

hyw520110 commented 5 years ago

version:

<dubbo.version>2.7.1</dubbo.version>
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
<spring-cloud-commons.version>2.1.1.RELEASE</spring-cloud-commons.version>
<spring-cloud-alibaba.version>0.9.1.BUILD-SNAPSHOT</spring-cloud-alibaba.version>

dependency:

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-dubbo</artifactId>
    </dependency>

or

           <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
    </dependency>
          <dependency>
        <groupId>com.alibaba.spring.boot</groupId>
        <artifactId>dubbo-spring-boot-starter</artifactId>
        <version>2.0.0</version>
    </dependency>`

thread log:

image

Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.211-b12 mixed mode):

"Attach Listener" #8166 daemon prio=9 os_prio=0 tid=0x00007fb1e8028800 nid=0x4bb2 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"Keep-Alive-Timer" #8165 daemon prio=8 os_prio=0 tid=0x00007fb1f006d000 nid=0x4ba4 waiting on condition [0x00007fb1bc0d5000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at sun.net.www.http.KeepAliveCache.run(KeepAliveCache.java:172) at java.lang.Thread.run(Thread.java:748)

"DestroyJavaVM" #98 prio=5 os_prio=0 tid=0x00007fb2103b2800 nid=0x5a2 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"com.alibaba.nacos.client.Worker.longPollingfixed-127.0.0.1_8848" #78 daemon prio=5 os_prio=0 tid=0x00007fb1c8006000 nid=0x6b8 runnable [0x00007fb1bbdd3000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345)

"NacosConfigListener-ThreadPool-1" #77 daemon prio=5 os_prio=0 tid=0x00007fb1c8005000 nid=0x6b7 waiting on condition [0x00007fb1d339e000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.push.receiver" #45 daemon prio=5 os_prio=0 tid=0x00007fb1c5f27800 nid=0x681 runnable [0x00007fb1bddf2000] java.lang.Thread.State: RUNNABLE at java.net.PlainDatagramSocketImpl.receive0(Native Method)

"com.alibaba.nacos.naming.failover" #44 daemon prio=5 os_prio=0 tid=0x00007fb1c5f24000 nid=0x680 waiting on condition [0x00007fb1bdef3000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.beat.sender" #43 daemon prio=5 os_prio=0 tid=0x00007fb1c5f22800 nid=0x67f waiting on condition [0x00007fb1bdff4000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.client.listener" #42 daemon prio=5 os_prio=0 tid=0x00007fb1c5f21800 nid=0x67e waiting on condition [0x00007fb1be0f5000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.client.naming.updater" #41 daemon prio=5 os_prio=0 tid=0x00007fb1c5ea4800 nid=0x67d waiting on condition [0x00007fb1be1f6000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"DubboRegistryRetryTimer-thread-1" #40 daemon prio=5 os_prio=0 tid=0x00007fb1c5e9c000 nid=0x67c waiting on condition [0x00007fb1be2f7000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at org.apache.dubbo.common.timer.HashedWheelTimer$Worker.waitForNextTick(HashedWheelTimer.java:539) at org.apache.dubbo.common.timer.HashedWheelTimer$Worker.run(HashedWheelTimer.java:442) at java.lang.Thread.run(Thread.java:748)

"com.alibaba.nacos.naming.push.receiver" #39 daemon prio=5 os_prio=0 tid=0x00007fb1c5e81000 nid=0x67b waiting on condition [0x00007fb1be5f8000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.failover" #38 daemon prio=5 os_prio=0 tid=0x00007fb1c5e77000 nid=0x67a waiting on condition [0x00007fb1be6f9000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.beat.sender" #37 daemon prio=5 os_prio=0 tid=0x00007fb1c5e76000 nid=0x679 waiting on condition [0x00007fb1be7fa000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.client.listener" #36 daemon prio=5 os_prio=0 tid=0x00007fb1c5e7d000 nid=0x678 waiting on condition [0x00007fb1be8fb000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.client.Worker.longPollingfixed-127.0.0.1_8848" #33 daemon prio=5 os_prio=0 tid=0x00007fb1c027e800 nid=0x677 waiting on condition [0x00007fb1beffc000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.client.Worker.fixed-127.0.0.1_8848" #32 daemon prio=5 os_prio=0 tid=0x00007fb1c5d67800 nid=0x676 waiting on condition [0x00007fb1bf0fd000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"Timer-1" #31 daemon prio=5 os_prio=0 tid=0x00007fb1c5d65800 nid=0x675 in Object.wait() [0x00007fb1bf1fe000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.util.TimerThread.mainLoop(Timer.java:552)

"com.alibaba.nacos.naming.push.receiver" #27 daemon prio=5 os_prio=0 tid=0x00007fb1c5416000 nid=0x664 runnable [0x00007fb1d084d000] java.lang.Thread.State: RUNNABLE at java.net.PlainDatagramSocketImpl.receive0(Native Method)

"com.alibaba.nacos.naming.failover" #26 daemon prio=5 os_prio=0 tid=0x00007fb1c5411800 nid=0x663 waiting on condition [0x00007fb1d094e000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.beat.sender" #25 daemon prio=5 os_prio=0 tid=0x00007fb1c5410000 nid=0x662 waiting on condition [0x00007fb1d0a4f000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.naming.client.listener" #24 daemon prio=5 os_prio=0 tid=0x00007fb1c5402800 nid=0x661 waiting on condition [0x00007fb1d25ec000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"com.alibaba.nacos.client.Worker.fixed-127.0.0.1_8848-417071d1-b6f5-448b-b2de-56ff4981f9cd" #22 daemon prio=5 os_prio=0 tid=0x00007fb1c4f3c000 nid=0x5f3 waiting on condition [0x00007fb1d1750000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"Timer-0" #21 daemon prio=5 os_prio=0 tid=0x00007fb1c4f37000 nid=0x5f2 in Object.wait() [0x00007fb1d1851000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.util.TimerThread.mainLoop(Timer.java:552)

"pool-2-thread-1" #18 prio=5 os_prio=0 tid=0x00007fb1c4eea800 nid=0x5ef waiting on condition [0x00007fb1d28ed000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"GC Daemon" #11 daemon prio=2 os_prio=0 tid=0x00007fb21044b800 nid=0x5be in Object.wait() [0x00007fb1f819e000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method)

"AsyncFileHandlerWriter-1259475182" #10 daemon prio=5 os_prio=0 tid=0x00007fb210182000 nid=0x5b5 waiting on condition [0x00007fb2001f6000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method)

"Service Thread" #7 daemon prio=9 os_prio=0 tid=0x00007fb2100c3800 nid=0x5af runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"C1 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007fb2100b8800 nid=0x5ae waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007fb2100b5800 nid=0x5ad waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x00007fb2100b4000 nid=0x5ac runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007fb210081000 nid=0x5ab in Object.wait() [0x00007fb200efd000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)

"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007fb21007e800 nid=0x5aa in Object.wait() [0x00007fb200ffe000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:502) at java.lang.ref.Reference.tryHandlePending(Reference.java:191)

"VM Thread" os_prio=0 tid=0x00007fb210075000 nid=0x5a9 runnable

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007fb210020800 nid=0x5a3 runnable

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x00007fb210022000 nid=0x5a4 runnable

"VM Periodic Task Thread" os_prio=0 tid=0x00007fb2100c6000 nid=0x5b0 waiting on condition

JNI global references: 1200

kathetina commented 5 years ago

dubbo 是 2.7.1 ,请问nacos是哪个版本?

hyw520110 commented 5 years ago

nacos server 1.0.0

chuntaojun commented 5 years ago

https://github.com/alibaba/spring-cloud-alibaba/issues/859

chuntaojun commented 5 years ago

分析文章:https://www.liaochuntao.cn/2019/09/04/java-web-53/