我在ubuntu上,我需要确认tomcat正在使用堆大小设置。
我该怎么做?
我尝试了jmap,但这似乎不在服务器上,我能以某种方式单独下载吗?
答案 0 :(得分:6)
使用-Xmx256m
命令检查ps
的过程参数:
bahadir@dev1:/$ ps -ef | grep java
tomcat6 804 1 13 15:29 ? 00:00:23 /usr/lib/jvm/java-6-openjdk/bin/java
-Djava.util.logging.config.file=/var/lib/tomcat6/conf/logging.properties
-Djava.awt.headless=true -Xmx256m -XX:+UseConcMarkSweepGC
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.endorsed.dirs=/usr/share/tomcat6/endorsed
-classpath /usr/share/tomcat6/bin/bootstrap.jar
-Dcatalina.base=/var/lib/tomcat6
-Dcatalina.home=/usr/share/tomcat6
-Djava.io.tmpdir=/tmp/tomcat6-tmp org.apache.catalina.startup.Bootstrap start
答案 1 :(得分:4)
tomcat使用的堆大小(与任何其他java应用程序一样)由jvm -Xmx param确定。
因此,如果您的tomcat作为Windows服务运行,您将创建环境变量CATALINA_OPTS = -Xms64m -Xmx256m。
然后,查看文件tomcat-install / bin / catalina.sh(.bat)和startup.sh(.bat),并检查param JAVA_OPTS -Xmx1024m或类似的东西。
良好的链接: http://javahowto.blogspot.com/2006/06/6-common-errors-in-setting-java-heap.html http://www.coderanch.com/t/87422/Tomcat/increase-java-heap-size
答案 2 :(得分:0)
你可以很容易地用jmap做到这一点。
$ jmap -heap [PID]
例如,首先找到PID:
$ ps aux | grep tomcat
user123 61906 ... etc
然后使用-heap
选项使用jmap附加到流程:
$ jmap -heap 61906
这将打印以下非常详细的输出,您可以在其中发现您的设置是否正在使用:
Attaching to process ID 61907, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 24.80-b11
using parallel threads in the new generation.
using thread-local object allocation.
Concurrent Mark-Sweep GC
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 25769803776 (24576.0MB)
NewSize = 6442450944 (6144.0MB)
MaxNewSize = 6442450944 (6144.0MB)
OldSize = 12884901888 (12288.0MB)
NewRatio = 2
SurvivorRatio = 4
PermSize = 21757952 (20.75MB)
MaxPermSize = 1073741824 (1024.0MB)
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 5368709120 (5120.0MB)
used = 2529188080 (2412.021713256836MB)
free = 2839521040 (2707.978286743164MB)
47.10979908704758% used
Eden Space:
capacity = 4294967296 (4096.0MB)
used = 2525489264 (2408.4942474365234MB)
free = 1769478032 (1687.5057525634766MB)
58.80112908780575% used
From Space:
capacity = 1073741824 (1024.0MB)
used = 3698816 (3.5274658203125MB)
free = 1070043008 (1020.4725341796875MB)
0.3444790840148926% used
To Space:
capacity = 1073741824 (1024.0MB)
used = 0 (0.0MB)
free = 1073741824 (1024.0MB)
0.0% used
concurrent mark-sweep generation:
capacity = 19327352832 (18432.0MB)
used = 10172808584 (9701.546272277832MB)
free = 9154544248 (8730.453727722168MB)
52.63425711956289% used
Perm Generation:
capacity = 195915776 (186.83984375MB)
used = 107975920 (102.97386169433594MB)
free = 87939856 (83.86598205566406MB)
55.11343813374172% used