Java非堆内存 - 如何减少它

时间:2013-11-11 08:07:52

标签: java memory-management heap

我们在服务器上运行Tomcat,并将多个Java Apps配置为虚拟主机。它已经运行了好几个月,很少或没有交换vmstat,但最近vmstat在类似的负载条件下跳跃到超过500 MB。

以下是JVM Top工具和vmstat的输出。我发现Non-Heap内存明显高于Heap,这在我们的应用程序角度非常出乎意料。

有人可以指出如何修复它。该应用程序在远程服务器上运行,因此无法使用图形工具。

 PID 28085: org.apache.catalina.startup.Bootstrap
 ARGS: start
 VMARGS: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properti[...]
 VM: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 1.7.0
 UP: 105:58m #THR: 49   #THRPEAK: 85   #THRCREATED: 4362 USER: root
 GC-Time:  0: 6m   #GC-Runs: 3058      #TotalLoadedClasses: 108669
 CPU:  0.00% GC:  0.00% HEAP: 260m / 989m NONHEAP: 733m /1072m

  TID   NAME                                    STATE    CPU  TOTALCPU BLOCKEDBY
 Note: Only top 10 threads (according cpu load) are shown!
[2J[H JvmTop 0.8.0 alpha - 17:05:06,  amd64,  1 cpus, Linux 2.6.18-23, load avg 1.55
 http://code.google.com/p/jvmtop

 PID 28085: org.apache.catalina.startup.Bootstrap
 ARGS: start
 VMARGS: -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properti[...]
 VM: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 1.7.0
 UP: 105:58m #THR: 49   #THRPEAK: 85   #THRCREATED: 4362 USER: root
 GC-Time:  0: 6m   #GC-Runs: 3058      #TotalLoadedClasses: 108671
 CPU:  3.26% GC:  0.00% HEAP: 261m / 989m NONHEAP: 733m /1072m

  TID   NAME                                    STATE    CPU  TOTALCPU BLOCKEDBY
   4368 RMI TCP Connection(111)-XXX.XX       RUNNABLE  3.98%     0.00%
   4369 JMX server connection timeout   TIMED_WAITING  0.12%     0.00%
     45 http-bio-/127.0.0.1-8080-Async  TIMED_WAITING  0.00%     0.20%
     47 ajp-bio-/127.0.0.1-8009-AsyncT  TIMED_WAITING  0.00%     0.20%
   4364 ajp-bio-/127.0.0.1-8009-exec-2       RUNNABLE  0.00%     0.00%
   4363 ajp-bio-/127.0.0.1-8009-exec-2       RUNNABLE  0.00%     0.00%
   4353 ajp-bio-/127.0.0.1-8009-exec-2       RUNNABLE  0.00%     0.01%
   4338 ajp-bio-/127.0.0.1-8009-exec-2       RUNNABLE  0.00%     0.01%
   4337 ajp-bio-/127.0.0.1-8009-exec-2       RUNNABLE  0.00%     0.00%
   4336 ajp-bio-/127.0.0.1-8009-exec-2       RUNNABLE  0.00%     0.01%
 Note: Only top 10 threads (according cpu load) are shown!

vmstat的输出

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 491540  35152  38404 240572    2    1   283   222    4    2  7  1 87  5  0
 0  0 491540  34920  38512 240864   32    0   380     0  223  375 20  1 46 33  0
 0  0 491540  34920  38512 240864    0    0     0     0  105   64  0  0 100  0  0
 0  0 491540  34920  38512 240904    0    0     0    16  109   67  0  0 100  0  0
 0  0 491540  34860  38540 240952    0    0    48     0  132  154  4  5 87  5  0

0 个答案:

没有答案