高CPU使用率,几乎所有线程都处于BLOCKED STATE状态

时间:2014-03-19 01:28:19

标签: java multithreading

我在tomcat容器中运行Java App。线程转储显示大多数线程处于BLOCKED状态。当我看到Heap用法时,我得到以下输出:

Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 2147483648 (2048.0MB)
   NewSize          = 1310720 (1.25MB)
   MaxNewSize       = 17592186044415 MB
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 85983232 (82.0MB)
   G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
PS Young Generation
Eden Space:
   capacity = 652214272 (622.0MB)
   used     = 652214264 (621.9999923706055MB)
   free     = 8 (7.62939453125E-6MB)
   99.99999877340925% used
From Space:
   capacity = 31981568 (30.5MB)
   used     = 0 (0.0MB)
   free     = 31981568 (30.5MB)
   0.0% used
To Space:
   capacity = 31981568 (30.5MB)
   used     = 0 (0.0MB)
   free     = 31981568 (30.5MB)
   0.0% used
PS Old Generation
   capacity = 1431830528 (1365.5MB)
   used     = 1281314952 (1221.957160949707MB)
   free     = 150515576 (143.54283905029297MB)
   89.48789168434325% used
PS Perm Generation
   capacity = 71303168 (68.0MB)
   used     = 71127952 (67.83290100097656MB)
   free     = 175216 (0.1670989990234375MB)
   99.75426617790671% used

27815 interned Strings occupying 4203968 bytes.

有人可以帮我调试吗?配置有问题吗?

编辑:

CPU使用率:

Cpu(s): 97.7%us,  1.0%sy,  0.0%ni,  1.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   3840320k total,  3741664k used,    98656k free,   103276k buffers
Swap:  4194300k total,   160692k used,  4033608k free,   783984k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                         
23112 root      20   0 3562m 2.4g 8040 S  195 65.2 397:25.18 java  

1 个答案:

答案 0 :(得分:0)

你的所有记忆都在被使用,所以也许会有一些事情发生。您需要堆转储并使用Eclipse MemoryAnalizer之类的工具来查看是否存在内存泄漏。也许应用程序只是颠簸,线程阻塞等待IO。听起来很可能。

但可能还有其他问题。该应用程序是否使用数据库,消息队列,FTP站点,REST服务等?仅JVM并不会像那样疯狂和爆炸,而是你试图做的事情导致它。