在Java、J2EE大型应用中,JVM非标准参数的配置直接关系到整个系统的性能。
JVM非标准参数指的是JVM底层的一些配置参数,这些参数在一般开发中默认即可,不需要任何配置。但是在生产环境中,为了提高性能,往往需要调整这些参数,以求系统达到最佳新能。
另外这些参数的配置也是影响系统稳定性的一个重要因素,相信大多数Java开发人员都见过“OutOfMemory”类型的错误。呵呵,这其中很可能就是JVM参数配置不当或者就没有配置没意识到配置引起的。
为了说明这些参数,还需要说说JDK中的命令行工具一些知识做铺垫。
首先看如何获取这些命令配置信息说明:
假设你是windows平台,你安装了J2SDK,那么现在你从cmd控制台窗口进入J2SDK安装目录下的bin目录,然后运行java命令,出现如下结果,这些就是包括java.exe工具的和JVM的所有命令都在里面。
———————————————————————–
D:j2sdk15bin>java
Usage: java [-options] class [args…]
(to execute a class)
or java [-options] -jar jarfile [args…]
(to execute a jar file)
where options include:
-client to select the “client” VM
-server to select the “server” VM
-hotspot is a synonym for the “client” VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:…|:]
-enableassertions[:…|:]
enable assertions
-da[:…|:]
-disableassertions[:…|:]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=]
load native agent library by full pathname
-javaagent:<jarpath>[=]
load Java programming language agent, see java.lang.instrument
———————————————————————–
在控制台输出信息中,有个-X(注意是大写)的命令,这个正是查看JVM配置参数的命令。
其次,用java -X 命令查看JVM的配置说明:
运行后如下结果,这些就是配置JVM参数的秘密武器,这些信息都是英文的,为了方便阅读,我根据自己的理解翻译成中文了(不准确的地方还请各位博友斧正)
———————————————————————–
D:j2sdk15bin>java -X
-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xfuture enable strictest checks, anticipating future default
-Xrs reduce use of OS signals by Java/VM (see documentation)
-Xcheck:jni perform additional checks for JNI functions
-Xshare:off do not attempt to use shared class data
-Xshare:auto use shared class data if possible (default)
-Xshare:on require using shared class data, otherwise fail.
The -X options are non-standard and subject to change without notice.
———————————————————————–
JVM配置参数中文说明:
———————————————————————–
1、-Xmixed mixed mode execution (default)
混合模式执行
2、-Xint interpreted mode execution only
解释模式执行
3、-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
设置zip/jar资源或者类(.class文件)存放目录路径
3、-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
追加zip/jar资源或者类(.class文件)存放目录路径
4、-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
预先加载zip/jar资源或者类(.class文件)存放目录路径
5、-Xnoclassgc disable class garbage collection
关闭类垃圾回收功能
6、-Xincgc enable incremental garbage collection
开启类的垃圾回收功能
7、-Xloggc:<file> log GC status to a file with time stamps
记录垃圾回日志到一个文件。
8、-Xbatch disable background compilation
关闭后台编译
9、-Xms<size> set initial Java heap size
设置JVM初始化堆内存大小
10、-Xmx<size> set maximum Java heap size
设置JVM最大的堆内存大小
11、-Xss<size> set java thread stack size
设置JVM栈内存大小
12、-Xprof output cpu profiling data
输入CPU概要表数据
13、-Xfuture enable strictest checks, anticipating future default
执行严格的代码检查,预测可能出现的情况
14、-Xrs reduce use of OS signals by Java/VM (see documentation)
通过JVM还原操作系统信号
15、-Xcheck:jni perform additional checks for JNI functions
对JNI函数执行检查
16、-Xshare:off do not attempt to use shared class data
尽可能不去使用共享类的数据
17、-Xshare:auto use shared class data if possible (default)
尽可能的使用共享类的数据
18、-Xshare:on require using shared class data, otherwise fail.
尽可能的使用共享类的数据,否则运行失败
The -X options are non-standard and subject to change without notice.
———————————————————————–
怎么用这这些参数呢?其实所有的命令行都是这么一用,下面我就给出一个最简单的HelloWorl的例子来演示这个参数的用法,非常的简单。
HelloWorld.java
———————————————–
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println(“Hello World!”);
}
}
编译并运行:
D:j2sdk15bin>javac HelloWorld.java
D:j2sdk15bin>java -Xms256M -Xmx512M HelloWorld
Hello World!
呵呵,这下满足了吧!
实践:在大型系统或者应用中配置JVM参数
比如你配置IDE工具的参数,常见的有IDEA、Eclipse,这个是在一个配置文件中指定即可。
如果你要在J2EE环境中配置这些参数,那么你需要在J2EE应用服务器或者Servlet容器相关启动参数设置处指定,其启动文件中来配置,Tomcat是在catalina.bat中配置,weblogic和websphere是在其他地方,具体我就说了,相信玩过的这些大型服务器的人都知道,没玩过的看看这篇文章,玩玩就知道了,呵呵。
另外常常有人问到jdk的一些相关命令用法,其实,当你看到这里的时候,你应该知道如何获取这些命令的用法了。如果你还不会,那么,建议你去学学DOS,我是没辙了。如果你会这些,还是没有看明白,那么你赶紧学学英语吧,这样你就能看懂了。
另外:我在最后给出常用的几个Java命令行说明,以供参考:
(1)、javac
用法:javac <选项> <源文件>
其中,可能的选项包括:
-g 生成所有调试信息
-g:none 不生成任何调试信息
-g:{lines,vars,source} 只生成某些调试信息
-nowarn 不生成任何警告
-verbose 输出有关编译器正在执行的操作的消息
-deprecation 输出使用已过时的 API 的源位置
-classpath <路径> 指定查找用户类文件的位置
-cp <路径> 指定查找用户类文件的位置
-sourcepath <路径> 指定查找输入源文件的位置
-bootclasspath <路径> 覆盖引导类文件的位置
-extdirs <目录> 覆盖安装的扩展目录的位置
-endorseddirs <目录> 覆盖签名的标准路径的位置
-d <目录> 指定存放生成的类文件的位置
-encoding <编码> 指定源文件使用的字符编码
-source <版本> 提供与指定版本的源兼容性
-target <版本> 生成特定 VM 版本的类文件
-version 版本信息
-help 输出标准选项的提要
-X 输出非标准选项的提要
-J<标志> 直接将 <标志> 传递给运行时系统
(2)、jar
用法:jar {ctxu}[vfm0Mi] [jar-文件] [manifest-文件] [-C 目录] 文件名 …
选项:
-c 创建新的存档
-t 列出存档内容的列表
-x 展开存档中的命名的(或所有的〕文件
-u 更新已存在的存档
-v 生成详细输出到标准输出上
-f 指定存档文件名
-m 包含来自标明文件的标明信息
-0 只存储方式;未用ZIP压缩格式
-M 不产生所有项的清单(manifest〕文件
-i 为指定的jar文件产生索引信息
-C 改变到指定的目录,并且包含下列文件:
如果一个文件名是一个目录,它将被递归处理。
清单(manifest〕文件名和存档文件名都需要被指定,按’m’ 和 ‘f’标志指定的相同顺序。
示例1:将两个class文件存档到一个名为 ‘classes.jar’ 的存档文件中:
jar cvf classes.jar Foo.class Bar.class
示例2:用一个存在的清单(manifest)文件 ‘mymanifest’ 将 foo/ 目录下的所有
文件存档到一个名为 ‘classes.jar’ 的存档文件中:
jar cvfm classes.jar mymanifest -C foo/ .
(3)、javadoc
javadoc: 错误 – 未指定软件包或类。
用法:javadoc [选项] [软件包名称] [源文件] [@file]
-overview <文件> 读取 HTML 文件的概述文档
-public 仅显示公共类和成员
-protected 显示受保护/公共类和成员(默认)
-package 显示软件包/受保护/公共类和成员
-private 显示所有类和成员
-help 显示命令行选项并退出
-doclet <类> 通过替代 doclet 生成输出
-docletpath <路径> 指定查找 doclet 类文件的位置
-sourcepath <路径列表> 指定查找源文件的位置
-classpath <路径列表> 指定查找用户类文件的位置
-exclude <软件包列表> 指定要排除的软件包的列表
-subpackages <子软件包列表> 指定要递归装入的子软件包
-breakiterator 使用 BreakIterator 计算第 1 句
-bootclasspath <路径列表> 覆盖引导类加载器所装入的
类文件的位置
-source <版本> 提供与指定版本的源兼容性
-extdirs <目录列表> 覆盖安装的扩展目录的位置
-verbose 输出有关 Javadoc 正在执行的操作的消息
-locale <名称> 要使用的语言环境,例如 en_US 或 en_US_WIN
-encoding <名称> 源文件编码名称
-quiet 不显示状态消息
-J<标志> 直接将 <标志> 传递给运行时系统
通过标准 doclet 提供:
-d <目录> 输出文件的目标目录
-use 创建类和软件包用法页面
-version 包含 @version 段
-author 包含 @author 段
-docfilessubdirs 递归复制文档文件子目录
-splitindex 将索引分为每个字母对应一个文件
-windowtitle <文本> 文档的浏览器窗口标题
-doctitle <html 代码> 包含概述页面的标题
-header <html 代码> 包含每个页面的页眉文本
-footer <html 代码> 包含每个页面的页脚文本
-bottom <html 代码> 包含每个页面的底部文本
-link <url> 创建指向位于 <url> 的 javadoc 输出的链接
-linkoffline <url> <url2> 利用位于 <url2> 的软件包列表链接至位于 <url>
的文档
-excludedocfilessubdir <名称 1>:..排除带有给定名称的所有文档文件子目录。
-group <名称> <p1>:<p2>.. 在概述页面中,将指定的软件包分组
-nocomment 抑止描述和标记,只生成声明。
-nodeprecated 不包含 @deprecated 信息
-noqualifier <名称 1>:<名称 2>:…从输出中排除限定符的列表。
-nosince 不包含 @since 信息
-notimestamp 不包含隐藏时间戳
-nodeprecatedlist 不生成已过时的列表
-notree 不生成类分层结构
-noindex 不生成索引
-nohelp 不生成帮助链接
-nonavbar 不生成导航栏
-serialwarn 生成有关 @serial 标记的警告
-tag <名称>:<位置>:<标题> 指定单个变量自定义标记
-taglet 要注册的 Taglet 的全限定名称
-tagletpath Taglet 的路径
-charset <字符集> 用于跨平台查看生成的文档的字符集。
-helpfile <文件> 包含帮助链接所链接到的文件
-linksource 以 HTML 格式生成源
-sourcetab <制表符长度> 指定源中每个制表符占据的空格数
-keywords 使软件包、类和成员信息附带 HTML 元标记
-stylesheetfile <路径> 用于更改生成文档的样式的文件
-docencoding <名称> 输出编码名称
(4)、rmid
rmid: 非法选项:-?
用法:rmid <option>
其中,<option> 包括:
-port <option> 指定供 rmid 使用的端口
-log <directory> 指定 rmid 将日志写入的目录
-stop 停止当前的 rmid 调用(对指定端口)
-C<runtime 标记> 向每个子进程传递参数(激活组)
-J<runtime 标记> 向 java 解释程序传递参数
有关更多的java命令可以参考一下这个文章:
http://ruruhuang.javaeye.com/blog/47564
http://kenwublog.com/docs/java6-jvm-options-chinese-edition.htm
以上资料转自:http://lavasoft.blog.51cto.com/62575/25492
一些有用的-XX选项,来自oracle:
Behavioral Options
Option and Default Value
|
Description
|
-XX:-AllowUserSignalHandlers
|
Do not complain if the application installs signal handlers. (Relevant to Solaris and Linux only.)
|
-XX:AltStackSize=16384
|
Alternate signal stack size (in Kbytes). (Relevant to Solaris only, removed from 5.0.)
|
-XX:-DisableExplicitGC
|
By default calls to System.gc() are enabled (-XX:-DisableExplicitGC). Use -XX:+DisableExplicitGC to disable calls to System.gc(). Note that the JVM still performs garbage collection when necessary.
|
-XX:+FailOverToOldVerifier
|
Fail over to old verifier when the new type checker fails. (Introduced in 6.)
|
-XX:+HandlePromotionFailure
|
The youngest generation collection does not require a guarantee of full promotion of all live objects. (Introduced in 1.4.2 update 11) [5.0 and earlier: false.]
|
-XX:+MaxFDLimit
|
Bump the number of file descriptors to max. (Relevant to Solaris only.)
|
-XX:PreBlockSpin=10
|
Spin count variable for use with -XX:+UseSpinning. Controls the maximum spin iterations allowed before entering operating system thread synchronization code. (Introduced in 1.4.2.)
|
-XX:-RelaxAccessControlCheck
|
Relax the access control checks in the verifier. (Introduced in 6.)
|
-XX:+ScavengeBeforeFullGC
|
Do young generation GC prior to a full GC. (Introduced in 1.4.1.)
|
-XX:+UseAltSigs
|
Use alternate signals instead of SIGUSR1 and SIGUSR2 for VM internal signals. (Introduced in 1.3.1 update 9, 1.4.1. Relevant to Solaris only.)
|
-XX:+UseBoundThreads
|
Bind user level threads to kernel threads. (Relevant to Solaris only.)
|
-XX:-UseConcMarkSweepGC
|
Use concurrent mark-sweep collection for the old generation. (Introduced in 1.4.1)
|
-XX:+UseGCOverheadLimit
|
Use a policy that limits the proportion of the VM’s time that is spent in GC before an OutOfMemory error is thrown. (Introduced in 6.)
|
-XX:+UseLWPSynchronization
|
Use LWP-based instead of thread based synchronization. (Introduced in 1.4.0. Relevant to Solaris only.)
|
-XX:-UseParallelGC
|
Use parallel garbage collection for scavenges. (Introduced in 1.4.1)
|
-XX:-UseParallelOldGC
|
Use parallel garbage collection for the full collections. Enabling this option automatically sets -XX:+UseParallelGC. (Introduced in 5.0 update 6.)
|
-XX:-UseSerialGC
|
Use serial garbage collection. (Introduced in 5.0.)
|
-XX:-UseSpinning
|
Enable naive spinning on Java monitor before entering operating system thread synchronizaton code. (Relevant to 1.4.2 and 5.0 only.) [1.4.2, multi-processor Windows platforms: true]
|
-XX:+UseTLAB
|
Use thread-local object allocation (Introduced in 1.4.0, known as UseTLE prior to that.) [1.4.2 and earlier, x86 or with -client: false]
|
-XX:+UseSplitVerifier
|
Use the new type checker with StackMapTable attributes. (Introduced in 5.0.)[5.0: false]
|
-XX:+UseThreadPriorities
|
Use native thread priorities.
|
-XX:+UseVMInterruptibleIO
|
Thread interrupt before or with EINTR for I/O operations results in OS_INTRPT. (Introduced in 6. Relevant to Solaris only.)
|
Back to Options
Garbage First (G1) Garbage Collection Options
Option and Default Value
|
Description
|
-XX:+UseG1GC
|
Use the Garbage First (G1) Collector
|
-XX:MaxGCPauseMillis=n
|
Sets a target for the maximum GC pause time. This is a soft goal, and the JVM will make its best effort to achieve it.
|
-XX:InitiatingHeapOccupancyPercent=n
|
Percentage of the (entire) heap occupancy to start a concurrent GC cycle. It is used by GCs that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (e.g., G1). A value of 0 denotes ‘do constant GC cycles’. The default value is 45.
|
-XX:NewRatio=n
|
Ratio of old/new generation sizes. The default value is 2.
|
-XX:SurvivorRatio=n
|
Ratio of eden/survivor space size. The default value is 8.
|
-XX:MaxTenuringThreshold=n
|
Maximum value for tenuring threshold. The default value is 15.
|
-XX:ParallelGCThreads=n
|
Sets the number of threads used during parallel phases of the garbage collectors. The default value varies with the platform on which the JVM is running.
|
-XX:ConcGCThreads=n
|
Number of threads concurrent garbage collectors will use. The default value varies with the platform on which the JVM is running.
|
-XX:G1ReservePercent=n
|
Sets the amount of heap that is reserved as a false ceiling to reduce the possibility of promotion failure. The default value is 10.
|
-XX:G1HeapRegionSize=n
|
With G1 the Java heap is subdivided into uniformly sized regions. This sets the size of the individual sub-divisions. The default value of this parameter is determined ergonomically based upon heap size. The minimum value is 1Mb and the maximum value is 32Mb.
|
Back to Options
Performance Options
Option and Default Value
|
Description
|
-XX:+AggressiveOpts
|
Turn on point performance compiler optimizations that are expected to be default in upcoming releases. (Introduced in 5.0 update 6.)
|
-XX:CompileThreshold=10000
|
Number of method invocations/branches before compiling [-client: 1,500]
|
-XX:LargePageSizeInBytes=4m
|
Sets the large page size used for the Java heap. (Introduced in 1.4.0 update 1.) [amd64: 2m.]
|
-XX:MaxHeapFreeRatio=70
|
Maximum percentage of heap free after GC to avoid shrinking.
|
-XX:MaxNewSize=size
|
Maximum size of new generation (in bytes). Since 1.4, MaxNewSize is computed as a function of NewRatio. [1.3.1 Sparc: 32m; 1.3.1 x86: 2.5m.]
|
-XX:MaxPermSize=64m
|
Size of the Permanent Generation. [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.]
|
-XX:MinHeapFreeRatio=40
|
Minimum percentage of heap free after GC to avoid expansion.
|
-XX:NewRatio=2
|
Ratio of old/new generation sizes. [Sparc -client: 8; x86 -server: 8; x86 -client: 12.]-client: 4 (1.3) 8 (1.3.1+), x86: 12]
|
-XX:NewSize=2m
|
Default size of new generation (in bytes) [5.0 and newer: 64 bit VMs are scaled 30% larger; x86: 1m; x86, 5.0 and older: 640k]
|
-XX:ReservedCodeCacheSize=32m
|
Reserved code cache size (in bytes) – maximum code cache size. [Solaris 64-bit, amd64, and -server x86: 2048m; in 1.5.0_06 and earlier, Solaris 64-bit and amd64: 1024m.]
|
-XX:SurvivorRatio=8
|
Ratio of eden/survivor space size [Solaris amd64: 6; Sparc in 1.3.1: 25; other Solaris platforms in 5.0 and earlier: 32]
|
-XX:TargetSurvivorRatio=50
|
Desired percentage of survivor space used after scavenge.
|
-XX:ThreadStackSize=512
|
Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.]
|
-XX:+UseBiasedLocking
|
Enable biased locking. For more details, see thistuning example. (Introduced in 5.0 update 6.) [5.0: false]
|
-XX:+UseFastAccessorMethods
|
Use optimized versions of Get<Primitive>Field.
|
-XX:-UseISM
|
Use Intimate Shared Memory. [Not accepted for non-Solaris platforms.] For details, see Intimate Shared Memory.
|
-XX:+UseLargePages
|
Use large page memory. (Introduced in 5.0 update 5.) For details, see Java Support for Large Memory Pages.
|
-XX:+UseMPSS
|
Use Multiple Page Size Support w/4mb pages for the heap. Do not use with ISM as this replaces the need for ISM. (Introduced in 1.4.0 update 1, Relevant to Solaris 9 and newer.) [1.4.1 and earlier: false]
|
-XX:+UseStringCache
|
Enables caching of commonly allocated strings.
|
-XX:AllocatePrefetchLines=1
|
Number of cache lines to load after the last object allocation using prefetch instructions generated in JIT compiled code. Default values are 1 if the last allocated object was an instance and 3 if it was an array.
|
-XX:AllocatePrefetchStyle=1
|
Generated code style for prefetch instructions.
0 – no prefetch instructions are generate*d*,
1 – execute prefetch instructions after each allocation,
2 – use TLAB allocation watermark pointer to gate when prefetch instructions are executed.
|
-XX:+UseCompressedStrings
|
Use a byte[] for Strings which can be represented as pure ASCII. (Introduced in Java 6 Update 21 Performance Release)
|
-XX:+OptimizeStringConcat
|
Optimize String concatenation operations where possible. (Introduced in Java 6 Update 20)
|
Back to Options
Debugging Options
Option and Default Value
|
Description
|
-XX:-CITime
|
Prints time spent in JIT Compiler. (Introduced in 1.4.0.)
|
-XX:ErrorFile=./hs_err_pid<pid>.log
|
If an error occurs, save the error data to this file. (Introduced in 6.)
|
-XX:-ExtendedDTraceProbes
|
Enable performance-impacting dtrace probes. (Introduced in 6. Relevant to Solaris only.)
|
-XX:HeapDumpPath=./java_pid<pid>.hprof
|
Path to directory or filename for heap dump.Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.)
|
-XX:-HeapDumpOnOutOfMemoryError
|
Dump heap to file when java.lang.OutOfMemoryError is thrown. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.)
|
-XX:OnError=”<cmd args>;<cmd args>”
|
Run user-defined commands on fatal error. (Introduced in 1.4.2 update 9.)
|
-XX:OnOutOfMemoryError=”<cmd args>;
<cmd args>”
|
Run user-defined commands when an OutOfMemoryError is first thrown. (Introduced in 1.4.2 update 12, 6)
|
-XX:-PrintClassHistogram
|
Print a histogram of class instances on Ctrl-Break.Manageable. (Introduced in 1.4.2.) The jmap -histocommand provides equivalent functionality.
|
-XX:-PrintConcurrentLocks
|
Print java.util.concurrent locks in Ctrl-Break thread dump. Manageable. (Introduced in 6.) The jstack -lcommand provides equivalent functionality.
|
-XX:-PrintCommandLineFlags
|
Print flags that appeared on the command line. (Introduced in 5.0.)
|
-XX:-PrintCompilation
|
Print message when a method is compiled.
|
-XX:-PrintGC
|
Print messages at garbage collection. Manageable.
|
-XX:-PrintGCDetails
|
Print more details at garbage collection. Manageable. (Introduced in 1.4.0.)
|
-XX:-PrintGCTimeStamps
|
Print timestamps at garbage collection. Manageable(Introduced in 1.4.0.)
|
-XX:-PrintTenuringDistribution
|
Print tenuring age information.
|
-XX:-PrintAdaptiveSizePolicy
|
Enables printing of information about adaptive generation sizing.
|
-XX:-TraceClassLoading
|
Trace loading of classes.
|
-XX:-TraceClassLoadingPreorder
|
Trace all classes loaded in order referenced (not loaded). (Introduced in 1.4.2.)
|
-XX:-TraceClassResolution
|
Trace constant pool resolutions. (Introduced in 1.4.2.)
|
-XX:-TraceClassUnloading
|
Trace unloading of classes.
|
-XX:-TraceLoaderConstraints
|
Trace recording of loader constraints. (Introduced in 6.)
|
-XX:+PerfDataSaveToFile
|
Saves jvmstat binary data on exit.
|
-XX:ParallelGCThreads=n
|
Sets the number of garbage collection threads in the young and old parallel garbage collectors. The default value varies with the platform on which the JVM is running.
|
-XX:+UseCompressedOops
|
Enables the use of compressed pointers (object references represented as 32 bit offsets instead of 64-bit pointers) for optimized 64-bit performance with Java heap sizes less than 32gb.
|
-XX:+AlwaysPreTouch
|
Pre-touch the Java heap during JVM initialization. Every page of the heap is thus demand-zeroed during initialization rather than incrementally during application execution.
|
-XX:AllocatePrefetchDistance=n
|
Sets the prefetch distance for object allocation. Memory about to be written with the value of new objects is prefetched into cache at this distance (in bytes) beyond the address of the last allocated object. Each Java thread has its own allocation point. The default value varies with the platform on which the JVM is running.
|
-XX:InlineSmallCode=n
|
Inline a previously compiled method only if its generated native code size is less than this. The default value varies with the platform on which the JVM is running.
|
-XX:MaxInlineSize=35
|
Maximum bytecode size of a method to be inlined.
|
-XX:FreqInlineSize=n
|
Maximum bytecode size of a frequently executed method to be inlined. The default value varies with the platform on which the JVM is running.
|
-XX:LoopUnrollLimit=n
|
Unroll loop bodies with server compiler intermediate representation node count less than this value. The limit used by the server compiler is a function of this value, not the actual value. The default value varies with the platform on which the JVM is running.
|
-XX:InitialTenuringThreshold=7
|
Sets the initial tenuring threshold for use in adaptive GC sizing in the parallel young collector. The tenuring threshold is the number of times an object survives a young collection before being promoted to the old, or tenured, generation.
|
-XX:MaxTenuringThreshold=n
|
Sets the maximum tenuring threshold for use in adaptive GC sizing. The current largest value is 15. The default value is 15 for the parallel collector and is 4 for CMS.
|
-Xloggc:<filename>
|
Log GC verbose output to specified file. The verbose output is controlled by the normal verbose GC flags.
|
-XX:-UseGCLogFileRotation
|
Enabled GC log rotation, requires -Xloggc.
|
-XX:NumberOfGClogFiles=1
|
Set the number of files to use when rotating logs, must be >= 1. The rotated log files will use the following naming scheme, <filename>.0, <filename>.1, …, <filename>.n-1.
|
-XX:GCLogFileSize=8K
|
The size of the log file at which point the log will be rotated, must be >= 8K.
|
以上参数来自官网:http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html