我们在我们的服务器上运行 Tomcat,并将几个 Java 应用程序配置为虚拟主机。几个月来它一直运行良好,vmstat 上的交换很少或没有交换,但最近 vmstat 在类似的负载条件下已跃升至 500 MB 以上。
以下是 JVM Top 工具和 vmstat 的输出。我看到非堆内存明显高于堆内存,这从我们的应用程序的角度来看是非常出乎意料的。
有人可以指点如何解决它。该应用程序在远程服务器上运行,因此无法使用图形工具。
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