1

项目运行后,线程越来越多

 2 years ago
source link: https://www.v2ex.com/t/838615
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Java

项目运行后,线程越来越多

  heyjude321 · 19 小时 1 分钟前 · 1306 次点击
大家好,请教个问题。
我的一个项目昨晚刚运行时用 top -Hp 显示 Threads 有 400 多。
现在过了十几个小时 显示有 700 多。
线程越来越多,这可能是什么原因呢?

最近 dubbo 遇到几次 Thread pool is EXHAUSTED!
初步判断是线程在 synchronized 内没退出,导致其他线程进不来。
我暂时移除了一些没必要的 synchronized ,是否能解决问题有待验证。

不知两者有没关联。

我对线程方面的知识马马虎虎,现在一头雾水,麻烦大家了。

top - 14:53:14 up 272 days, 14:33, 2 users, load average: 0.03, 0.08, 0.07
Threads: 784 total, 0 running, 784 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.3 us, 0.2 sy, 0.0 ni, 99.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 16265568 total, 2255248 free, 4649916 used, 9360404 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 11268112 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
11757 root 20 0 10.4g 1.2g 15192 S 0.3 7.8 0:36.19 java
11766 root 20 0 10.4g 1.2g 15192 S 0.3 7.8 0:30.22 java
8721 root 20 0 10.4g 1.2g 15192 S 0.3 7.8 0:00.25 java
1050 root 20 0 10.4g 1.2g 15192 S 0.3 7.8 0:00.17 java
5155 root 20 0 10.4g 1.2g 15192 S 0.3 7.8 0:00.17 java
11747 root 20 0 10.4g 1.2g 15192 S 0.0 7.8 0:00.00 java
11748 root 20 0 10.4g 1.2g 15192 S 0.0 7.8 0:11.86 java
11749 root 20 0 10.4g 1.2g 15192 S 0.0 7.8 0:07.78 java
11750 root 20 0 10.4g 1.2g 15192 S 0.0 7.8 0:07.79 java
11751 root 20 0 10.4g 1.2g 15192 S 0.0 7.8 0:07.77 java
11752 root 20 0 10.4g 1.2g 15192 S 0.0 7.8 0:07.74 java
11753 root 20 0 10.4g 1.2g 15192 S 0.0 7.8 0:07.78 java

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK