-
Search before asking
Apache SkyWalking ComponentJava Agent (apache/skywalking-java) What happenedVersion A function create 10000 threads.and the thread job just execute a simple SQL. In my guess, i think some of SW-agent thread blocked those "pool-5-thread-XXX". java code:
#### 线程状态排查
- 因为猜想可能是因为上报数据造成的影响,大概看了相关线程,底层使用grpc netty通信,线程数也不多,因为不清楚skywalking的具体实现,没有头绪
- 查看系统cpu,在提交10000个任务时robot.jar进程cpu使用率很高,开始排查线程cpu使用 top -Hp 5980 -> 5992 cpu使用率高 printf "%x" 5992 -> 1768 "SkywalkingAgent-5-JVMService-produce-0" #8 daemon prio=5 os_prio=0 tid=0x00007f11dc5b1800 nid=0x1768 runnable [0x00007f11c4f73000]
// org.apache.skywalking.apm.agent.core.jvm.thread.ThreadProvider
// 不启用skywalking-agent,但是自己启动一个线程信息的监控,并打印
监控结果
GetThreadInfo native方法简单分析
解决办法v1
解决办法v2因为修改获取线程监控信息的方法效率低,jdk中源码中也写了需要优化的相关注释, 想其他替代方法,想到jstack dump所有线程信息,这种其实就是一次性dump jvm中所有alive的线程信息。 修改为dumpAllThreads方法,测试下来,10000个线程工作时,往线程池提交任务是快了很多了,不至于阻塞请求
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
This is not even a real case. 1000 threads could burn CPU load easily. |
Beta Was this translation helpful? Give feedback.
This is not even a real case. 1000 threads could burn CPU load easily.
If you are just for fun, this is your own responsibility. Don't submit this strange and unreasonable case to the community.