查看JVM參數
開始—>運行輸入cmd
java -X (區分大小寫)
1、-Xmixed mixed mode execution (default)
混合模式執行(默認)
2、-Xint interpreted mode execution only
解釋模式執行
3、-Xbootclasspath:
set search path for bootstrap classes and resources
設置zip/jar資源或者類(.class文件)存放目錄路徑
3、-Xbootclasspath/a:
append to end of bootstrap class path
追加zip/jar資源或者類(.class文件)存放目錄路徑
4、-Xbootclasspath/p:
prepend in front of bootstrap class path
預先加載zip/jar資源或者類(.class文件)存放目錄路徑
5、-Xnoclassgc disable class garbage collection
關閉類垃圾回收功能
6、-Xincgc enable incremental garbage collection
開啓類的垃圾回收功能
7、-Xloggc:log GC status to a file with time stamps
記錄垃圾回日誌到一個文件。
8、-Xbatch disable background compilation
關閉後臺編譯
9、-Xms set initial Java heap size
設置JVM初始化堆內存大小
10、-Xmx set maximum Java heap size
設置JVM最大的堆內存大小
11、-Xss 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.
一般設置:
設置服務器端的 JVM:JAVA_OPTS="-server -Xms1000m -Xmx1000m -Xss512k"
-server:一定要作爲第一個參數,在多個CPU時性能佳
-Xms:初始Heap大小,使用的最小內存
-Xmx:java heap最大值,使用的最大內存
上面兩個值一般設置爲同樣的大小。
-Xss:每個線程的Stack大小
-verbose:gc 現實垃圾收集信息
-Xloggc:gc.log 指定垃圾收集日誌文件
-Xmn:young generation的heap大小,一般設置爲Xmx的3、4分之一
-XX:+UseParNewGC :縮短minor收集的時間
-XX:+UseConcMarkSweepGC :縮短major收集的時間
提示:此選項在Heap Size 比較大而且Major收集時間較長的情況下使用更合適