首页 > 解决方案 > java -AbandonedConnectionCleanupThread 占用更多 CPU 时间

问题描述

我的应用程序正在从 csv 读取数据并插入 mysql.its 占用更多 CPU。

当我在 jdbc 下调试时,线程占用了更多的 cpu。

com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40) 

森托斯,

1.顶部

7435 root      20   0 7677556 366436  14528 S  86.4  4.8  67:05.60 java

2.顶部

top -n 1 -H -p 7435
top - 15:48:23 up 57 days, 21 min, 11 users,  load average: 0.47, 0.53, 0.62
Threads:  28 total,   1 running,  27 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.9 us,  3.3 sy,  0.0 ni, 91.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  7650496 total,   188012 free,  1122392 used,  6340092 buff/cache
KiB Swap: 16777212 total, 16775664 free,     1548 used.  5914108 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 7595 root      20   0 7677556 345864  14528 R 60.0  4.5 142:04.27 java
 7435 root      20   0 7677556 345864  14528 S  0.0  4.5   0:00.00 java
 7436 root      20   0 7677556 345864  14528 S  0.0  4.5   0:01.24 java
 7454 root      20   0 7677556 345864  14528 S  0.0  4.5   1:06.92 java
 7459 root      20   0 7677556 345864  14528 S  0.0  4.5   1:07.11 java

任何想法?

ExecutorService service=Executors.newFixedThreadPool(count);
            FileAlterationObserver fao = new FileAlterationObserver(folder);
            fao.addListener(new FileListener(service));
            final FileAlterationMonitor monitor = new FileAlterationMonitor(Integer.parseInt("100"));
            monitor.addObserver(fao);
            monitor.start();

每当listner收到csv时,我都会提交给Excutor服务

service.submit(new PerformanceFileReader(f));

标签: javamysql

解决方案


推荐阅读