常用参数表

参数 描述
-XX:+PrintGC 启动java虚拟机后,只要遇到gc,就打印日志
-XX:+PrintGCDetails gc发生时,打印更详细的日志
-XX:+PrintHeapAtGC 每一次GC后,都打印堆信息
-XX:+PrintGCTimeStamps gc发生时,额外打印gc时间,该时间为虚拟机启动到现在的时间偏移量
-XX:+PrintGCApplicationStoppedTime gc时打印应用程序由于gc产生停顿的时间
-XX:+PrintReferenceGC 跟踪系统的软引用,弱引用,虚引用和Finallize队列
-Xloggc 指定gc日志的保存路径。
-XX:+TraceClassLoading 跟踪类加载
-XX:+TraceClassUnloading 跟踪类卸载
-XX:+PrintVMOptions 程序运行时,打印虚拟机接收到的命令行显示参数
-XX:+PrintCommandLineFlags 打印传递给虚拟机的显式和隐式参数
-XX:+PrintFlagsFinal 打印所有系统参数的值
-XX:MaxHeapSize 指定最大内存
-XX:SurvivorRatio 指定新生代中eden区和from/to区的比例关系
-XX:NewRatio 设置老年代/新生代的比例
-XX:+HeapDumpOnOutOfMemoryError 内存溢出时,导出整个堆的信息,和下一个参数配合使用
-XX:HeapDumpPath 导出的堆信息的保存路径,和上一个参数配合使用
-XX:OnOutOfMemoryError 内存溢出发生错误时执行一个脚本文件
-XX:PermSize 配置初始永久区的大小(JDK8中永久区已经被彻底移除,使用了新的元数据区存放类的元数据)
-XX:MaxPermSize 配置最大永久区的大小(JDK8中永久区已经被彻底移除,使用了新的元数据区存放类的元数据)
-XX:MaxMetaspaceSize 指定元数据区最大可用值
-Xss 指定线程的栈大小
-Xms 指定初始堆空间的大小,例如-Xms20m,默认是物理内存的1/64
-Xmx 指定最大堆空间的大小,例如-Xmx100m,默认是物理内存的1/4
-Xmn 指定新生代的大小,例如-Xmn1m
-XX:MaxDirectMemorySize 指定最大可用直接内存值
-XX:+PrintCommandLineFlags 将隐式或者显示传给虚拟机的参数输出
-XX:+TraceClassLoading 监控加载的类信息(启动类加载器)
-server 指定虚拟机在server模式下工作
-client 指定虚拟机在client模式下工作
-XX:CMSInitiatingOccupancyFraction 设定CMS在内存占用率达到指定值时开始GC(因为CMS会有浮动垃圾,所以一般都较早启动GC),JDK5默认值68,而JDK6时默认值为92
-XX:+UseCMSInitiatingOccupancyOnly 只用设定的回收阈值,若没有指定,JVM仅在第一次使用设定值,后续会自动调整
-XX:+CMSScavengeBeforeRemark 在CMS GC前启动一次ygc,以减少old gen对ygc gen的引用,降低remark的时间(因为CMS GC耗时主要在remark阶段,该参数会使STW停顿时间变长

注:JDK8删除了永久区,用元数据区替代。

  • 将初始堆与最大堆大小设置相等,可以减少程序运行时的垃圾回收次数,从而提高性能。

  • 浅堆:一个对象结构所占用的内存大小
    对象大小按照8字节对齐、浅堆大小和对象的内容无关、只和对象的结构有关。

  • 深堆:一个对象被GC回收后,可以真实释放的内存大小
    只能通过对象访问到的所有对象的浅堆之和(支配树)

注:在命令行输入

  • java -verbose:class :输出程序运行时类被加载信息
  • java –verbose:gc :输出虚拟机发生内存回收时在输出设备显示信息
  • java -verbose:jni :输出native方法调用的相关情况,一般用于诊断jni调用错误信息
例1:

配置参数:
-Xms5m
-Xmx20m
-XX:+PrintGCDetails
-XX:+UseSerialGC
-XX:+PrintCommandLineFlags


public class MemoryInfo {
public static void main(String[] args) {
//查看GC信息
System.out.println("max memory : "+Runtime.getRuntime().maxMemory());
System.out.println("free memory : "+Runtime.getRuntime().freeMemory());
System.out.println("total memory : "+Runtime.getRuntime().totalMemory());
    <span class="token keyword">byte</span><span class="token punctuation">[</span><span class="token punctuation">]</span> b1 <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">byte</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token operator">*</span><span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token punctuation">]</span><span class="token punctuation">;</span>

    System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"分配1M  "</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"max memory : "</span><span class="token operator">+</span>Runtime<span class="token punctuation">.</span><span class="token function">getRuntime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">maxMemory</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"free memory : "</span><span class="token operator">+</span>Runtime<span class="token punctuation">.</span><span class="token function">getRuntime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">freeMemory</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"total memory : "</span><span class="token operator">+</span>Runtime<span class="token punctuation">.</span><span class="token function">getRuntime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">totalMemory</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token keyword">byte</span><span class="token punctuation">[</span><span class="token punctuation">]</span> b2 <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">byte</span><span class="token punctuation">[</span><span class="token number">4</span><span class="token operator">*</span><span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token punctuation">]</span><span class="token punctuation">;</span> System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"分配4M "</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"max memory : "</span><span class="token operator">+</span>Runtime<span class="token punctuation">.</span><span class="token function">getRuntime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">maxMemory</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"free memory : "</span><span class="token operator">+</span>Runtime<span class="token punctuation">.</span><span class="token function">getRuntime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">freeMemory</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"total memory : "</span><span class="token operator">+</span>Runtime<span class="token punctuation">.</span><span class="token function">getRuntime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">totalMemory</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">//GC日志第三个十六进制数减去第一个十六进制数</span>
<span class="token keyword">int</span> a <span class="token operator">=</span> <span class="token number">0x00000000fec00000</span><span class="token punctuation">;</span>
<span class="token keyword">int</span> b <span class="token operator">=</span> <span class="token number">0x00000000ff2a0000</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"结果为:"</span><span class="token operator">+</span><span class="token punctuation">(</span>b<span class="token operator">-</span>a<span class="token punctuation">)</span><span class="token operator">/</span><span class="token number">1024</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token punctuation">}</span>

}

输出结果(加注释):

//PrintCommandLineFlags命令打印的内容
-XX:InitialHeapSize=5242880 -XX:MaxHeapSize=20971520 -XX:+PrintCommandLineFlags -XX:+PrintGCDetails -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseSerialGC
//分配1M内存之后
[GC (Allocation Failure) [DefNew: 1664K->192K(1856K), 0.0014276 secs]
//1664k是GC之前该内存已使用容量,GC后该内存使用容量192k,1856k是该内存区域总容量(1M)
1664K->699K(5952K), 0.0014631 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//方括号之外:1664k表示GC前Java堆已使用量,699k表示GC后Java堆已使用量,5952表示Java堆总容量。
//最大内存
max memory : 20316160
//空闲内存(值不确定)
free memory : 4426464
//初始分配的5M内存大小
total memory : 6094848
[GC (Allocation Failure) [DefNew: 1121K->120K(1856K), 0.0011164 secs] 1629K->818K(5952K), 0.0011364 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
分配1M
max memory : 20316160
//分配了1M之后,空闲内存变小了1M
free memory : 4178496
//总内存不变
total memory : 6094848
//GC收集之后,新生代收集前1173k,收集后为0,老年代1841k,Metaspace(之前的永久区)
[GC (Allocation Failure) [DefNew: 1173K->0K(1856K), 0.0010111 secs][Tenured: 1841K->1841K(4096K), 0.0021631 secs] 1871K->1841K(5952K), [Metaspace: 3513K->3513K(1056768K)], 0.0032147 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
分配4M
max memory : 20316160
//因为申请4M,空闲内存不够,向最大内存申请
free memory : 4246464
//申请4M之后,总内存增加4M
total memory : 10358784
结果为:7556
//-XX:+PrintGCDetails命令打印的内容
Heap
//新生代区,第三个十六进制数减第一个等于used的值,第二个十六进制值没有实际意义
def new generation total 1920K, used 66K [0x00000000fec00000, 0x00000000fee10000, 0x00000000ff2a0000)
eden space 1728K, 3% used [0x00000000fec00000, 0x00000000fec10930, 0x00000000fedb0000)
from space 192K, 0% used [0x00000000fedb0000, 0x00000000fedb0000, 0x00000000fede0000)
to space 192K, 0% used [0x00000000fede0000, 0x00000000fede0000, 0x00000000fee10000)
//老年代区
tenured generation total 8196K, used 5937K [0x00000000ff2a0000, 0x00000000ffaa1000, 0x0000000100000000)
the space 8196K, 72% used [0x00000000ff2a0000, 0x00000000ff86c6c0, 0x00000000ff86c800, 0x00000000ffaa1000)
//元数据区,committed固定大小,reserved保留区大小
Metaspace used 3520K, capacity 4498K, committed 4864K, reserved 1056768K
class space used 388K, capacity 390K, committed 512K, reserved 1048576K

例2

配置参数

-Xms20m
-Xmx20m
-Xmn1m
-XX:SurvivorRatio=2
-XX:+PrintGCDetails
-XX:+UseSerialGC

public class DefNew {
<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span>String<span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token keyword">byte</span><span class="token punctuation">[</span><span class="token punctuation">]</span> b <span class="token operator">=</span> null<span class="token punctuation">;</span>
<span class="token comment">//连续向系统申请1M空间,一共10M</span>
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span> <span class="token number">10</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
b <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">byte</span><span class="token punctuation">[</span><span class="token number">1</span><span class="token operator">*</span><span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>

}

输出结果:

[GC (Allocation Failure) [DefNew: 512K->256K(768K), 0.0011276 secs] 512K->432K(20224K), 0.0011600 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 767K->112K(768K), 0.0010947 secs] 943K->544K(20224K), 0.0011160 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 624K->255K(768K), 0.0007053 secs] 1056K->703K(20224K), 0.0007267 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 767K->56K(768K), 0.0007107 secs] 1215K->728K(20224K), 0.0007333 secs] [Times: user=0.02 sys=0.00, real=0.00 secs]
Heap
def new generation total 768K, used 544K [0x00000000fec00000, 0x00000000fed00000, 0x00000000fed00000)
eden space 512K, 95% used [0x00000000fec00000, 0x00000000fec79f30, 0x00000000fec80000)
from space 256K, 21% used [0x00000000fec80000, 0x00000000fec8e128, 0x00000000fecc0000)
to space 256K, 0% used [0x00000000fecc0000, 0x00000000fecc0000, 0x00000000fed00000)
tenured generation total 19456K, used 10911K [0x00000000fed00000, 0x0000000100000000, 0x0000000100000000)
the space 19456K, 56% used [0x00000000fed00000, 0x00000000ff7a7f90, 0x00000000ff7a8000, 0x0000000100000000)
Metaspace used 3517K, capacity 4498K, committed 4864K, reserved 1056768K
class space used 388K, capacity 390K, committed 512K, reserved 1048576K

还有两种参数配置,如果有兴趣可以尝试配置,然后输出结果

(1)

-Xms20m -Xmx20m -Xmn1m -XX:SurvivorRatio=2 -XX:PrintGCDetails
-XX:+UseSerialGC

(2)

-Xms20m -Xmx20m -XX:NewRatio=2 -XX:PrintGCDetails -XX:+UseSerialGC

例3

配置参数
-Xms64m
-Xmx64m
-XX:+PrintGCDetails

public class EnterEdenSurvivor {
public static void main(String[] args) {
//初始化的对象在eden区
for (int i=0; i < 5; i++) {
byte[] b = new byte[1*1024*1024];
}
}
}

输出结果

Heap
PSYoungGen total 18944K, used 8403K [0x00000000feb00000, 0x0000000100000000, 0x0000000100000000)
eden space 16384K, 51% used [0x00000000feb00000,0x00000000ff334f80,0x00000000ffb00000)
from space 2560K, 0% used [0x00000000ffd80000,0x00000000ffd80000,0x0000000100000000)
to space 2560K, 0% used [0x00000000ffb00000,0x00000000ffb00000,0x00000000ffd80000)
ParOldGen total 44032K, used 0K [0x00000000fc000000, 0x00000000feb00000, 0x00000000feb00000)
object space 44032K, 0% used [0x00000000fc000000,0x00000000fc000000,0x00000000feb00000)
Metaspace used 3517K, capacity 4498K, committed 4864K, reserved 1056768K
class space used 388K, capacity 390K, committed 512K, reserved 1048576K

例4
配置参数
-Xmx1024m
-Xms1024m
-XX:+UseSerialGC
-XX:MaxTenuringThreshold=15
-XX:+PrintGCDetails

    public static void maxTenure() {
Map<Integer,byte[]> m = new HashMap<Integer,byte[]>();
for (int i = 0; i < 5; i++) {
byte[] b = new byte[1024*1024];
m.put(i,b);
}
    <span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> k <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> k <span class="token operator">&lt;</span> <span class="token number">20</span><span class="token punctuation">;</span> k<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token keyword">for</span> <span class="token punctuation">(</span><span class="token keyword">int</span> j <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> j <span class="token operator">&lt;</span> <span class="token number">300</span><span class="token punctuation">;</span> j<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token keyword">byte</span><span class="token punctuation">[</span><span class="token punctuation">]</span> b <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">byte</span><span class="token punctuation">[</span><span class="token number">1024</span><span class="token operator">*</span><span class="token number">1024</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>

输出结果

[GC (Allocation Failure) [DefNew: 278925K->5937K(314560K), 0.0035484 secs] 278925K->5937K(1013632K), 0.0035893 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
//中间省略类似的13行
[GC (Allocation Failure) [DefNew: 284897K->5903K(314560K), 0.0023524 secs] 284897K->5903K(1013632K), 0.0023898 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 284897K->0K(314560K), 0.0033498 secs] 284897K->5903K(1013632K), 0.0033751 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 278994K->0K(314560K), 0.0002507 secs] 284897K->5903K(1013632K), 0.0002911 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 278994K->0K(314560K), 0.0001911 secs] 284898K->5903K(1013632K), 0.0002124 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 278995K->0K(314560K), 0.0002929 secs] 284898K->5903K(1013632K), 0.0003164 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 278995K->0K(314560K), 0.0002338 secs] 284898K->5903K(1013632K), 0.0002560 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 278995K->0K(314560K), 0.0001902 secs] 284898K->5903K(1013632K), 0.0002102 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
[GC (Allocation Failure) [DefNew: 278995K->0K(314560K), 0.0001920 secs] 284898K->5903K(1013632K), 0.0002120 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
Heap
def new generation total 314560K, used 45992K [0x00000000c0000000, 0x00000000d5550000, 0x00000000d5550000)
eden space 279616K, 16% used [0x00000000c0000000, 0x00000000c2cea0e8, 0x00000000d1110000)
from space 34944K, 0% used [0x00000000d1110000, 0x00000000d1110000, 0x00000000d3330000)
to space 34944K, 0% used [0x00000000d3330000, 0x00000000d3330000, 0x00000000d5550000)
tenured generation total 699072K, used 5903K [0x00000000d5550000, 0x0000000100000000, 0x0000000100000000)
the space 699072K, 0% used [0x00000000d5550000, 0x00000000d5b13c50, 0x00000000d5b13e00, 0x0000000100000000)
Metaspace used 3519K, capacity 4498K, committed 4864K, reserved 1056768K
class space used 388K, capacity 390K, committed 512K, reserved 1048576K

例5

配置参数
-Xss1m

public class StackOverFlow {
<span class="token comment">//栈调用深度</span>
<span class="token keyword">private</span> <span class="token keyword">static</span> <span class="token keyword">int</span> count<span class="token punctuation">;</span> <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">recursion</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
count<span class="token operator">++</span><span class="token punctuation">;</span>
<span class="token function">recursion</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span>String<span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token punctuation">{<!-- --></span>
<span class="token keyword">try</span> <span class="token punctuation">{<!-- --></span>
<span class="token function">recursion</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token keyword">catch</span><span class="token punctuation">(</span>Throwable e<span class="token punctuation">)</span><span class="token punctuation">{<!-- --></span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"调用最大栈深度:"</span><span class="token operator">+</span>count<span class="token punctuation">)</span><span class="token punctuation">;</span>
e<span class="token punctuation">.</span><span class="token function">printStackTrace</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>

}

输出结果

调用最大栈深度:23533
java.lang.StackOverflowError
at jvm.StackOverFlow.recursion(StackOverFlow.java:19)
at jvm.StackOverFlow.recursion(StackOverFlow.java:19)
at jvm.StackOverFlow.recursion(StackOverFlow.java:19)
//省略一样的许多行

推荐JVM参数设置

应用场景:对于长连接,push一类的海量服务端应用,16G内存8核心,推荐的JVM参数如下(仅供参考):

JDK1.7 JDK1.8
Xms12g -
Xmx12g -
Xss512k -
-XX:PermSize=384m
-XX:MaxPermSize=384m
-XX:NewSize=12g -
-XX:MaxNewSize=12g -
-XX:SurvivorRatio=18 -
-XX:MaxDirectMemorySize=2g -
-XX:+UseParNewGC -
-XX:ParallelGCThreads=4 -
-XX:MaxTenuringThreshold=15 -
-XX:+CMSParallelRemarkEnabled -
-XX:+CMSScavengeBeforeRemark -
-XX:+UseConcMarkSweepGC -
-XX:+DisableExplicitGC -
-XX:+UseCMSInitiatingOccupancyOnly -
-XX:CMSInitiatingOccupancyFraction=70 -
-XX:+ScavengeBeforeFullGC -
-XX:+UseCMSCompactAtFullCollection -
-XX:CMSFullGCsBeforeCompaction=9 -
-XX:+CMSClassUnloadingEnabled -
-XX:CMSInitiatingPermOccupancyFraction=70 -
-XX:+ExplicitGCInvokesConcurrent -
-XX:+PrintGCDetails -
-XX:+PrintGCDateStamps -
-XX:+PrintGCApplicationConcurrentTime -
-XX:+PrintHeapAtGC -
-Xloggc:/data/applogs/heap_trace.txt -
-XX:-HeapDumpOnOutOfMemoryError -
-XX:HeapDumpPath=/data/applogs/heapdump_oom.hprof -

本人才疏学浅,若有错,请指出
谢谢!

文章知识点与官方知识档案匹配,可进一步学习相关知识
Java技能树首页概览106344 人正在系统学习中

[转帖]【JVM】常用虚拟机参数及实例的更多相关文章

  1. JVM调优系列:(五)JVM常用调试参数和工具

    转自:http://blog.csdn.net/opensure/article/details/46715769 JVM常用调试参数: –verbose:gc在虚拟机发生内存回收时在输出设备显示信息 ...

  2. JVM常用启动参数+常用内存调试工具

    一.JVM常用启动参数 -Xms:设置堆的最小值. -Xmx:设置堆的最大值. -Xmn:设置新生代的大小. -Xss:设置每个线程的栈大小. -XX:NewSize:设置新生代的初始值. -XX:M ...

  3. JVM常用虚拟机命令汇总

    title: JVM常用虚拟机命令汇总 comments: false date: 2019-07-22 11:45:33 description: 总结一下常用的JVM虚拟机启动命令. catego ...

  4. JVM 常用启动参数

    JVM 常用启动参数 默认值 -xms -xmx

  5. JVM常用启动参数

    本文参考 jvm参数设置大全:http://www.cnblogs.com/marcotan/p/4256885.html 堆内存分配及gc:http://www.cnblogs.com/weiguo ...

  6. [jvm] -- 常用内存参数配置篇

    新生代 ( Young ) 与老年代 ( Old ) 的比例的值为 1:2 ( 该值可以通过参数 –XX:NewRatio 来指定 ) Eden : from : to = 8 : 1 : 1 ( 可 ...

  7. 深入理解JVM一配置参数

    一.JVM配置参数分为三类参数: 1.跟踪参数 2.堆分配参数 3.栈分配参数 这三类参数分别用于跟踪监控JVM状态,分配堆内存以及分配栈内存. 二.跟踪参数 跟踪参数用于跟踪监控JVM,往往被开发人 ...

  8. 深入理解JVM虚拟机10:JVM常用参数以及调优实践

    转自http://www.rowkey.me/blog/2016/11/02/java-profile/?hmsr=toutiao.io&utm_medium=toutiao.io&u ...

  9. 生产环境下JVM调优参数的设置实例

    JVM基础:生产环境参数实例及分析 原始配置: -Xms128m -Xmx128m -XX:NewSize=64m -XX:PermSize=64m -XX:+UseConcMarkSweepGC - ...

  10. 如何设置Java虚拟机JVM启动内存参数

    Tomcat默认的Java虚拟机JVM启动内存参数大约只有64MB或者128MB,非常小,远远没有利用现在服务器的强大内存,所以要设置Java虚拟机JVM启动内存参数.具体设置方法为: Tomcat修 ...

随机推荐

  1. PostgreSQL常用运维SQL

    一.数据库连接 1.获取数据库实例连接数 select count(*) from pg_stat_activity; 2.获取数据库最大连接数 show max_connections 3.查询当前 ...

  2. Python实用技巧:将 Excel转为PDF

    将Excel文件转换为PDF可以方便储存表格数据,此外在打印或共享文档时也能确保表格样式布局等在不同设备和操作系统上保持一致.今天给大家分享一个使用第三方Python库Spire.XLS for Py ...

  3. 懂分析、会预测,你见过这样的华为云DAS吗?

    摘要:数字化时代下,华为云数据管理服务DAS基于AI技术,于近期推出了智能SQL分析(包括慢SQL发现.SQL透视).workload级别索引推荐.存储空间预测等运维特性,加上原有的数据库运维能力,构 ...

  4. CANN 6.0来了,硬核技术抢先看

    摘要:在华为全联接大会2022期间,华为正式官宣昇腾AI异构计算架构CANN 6.0版本将在年底正式发布. 本文分享自华为云社区<昇腾AI异构计算架构CANN 6.0全新开放升级,全面释放AI生 ...

  5. 揭秘GES超大规模图计算引擎HyG:图切分

    摘要:GES大规模图计算引擎HyG通过实现不同的点边分区算法,可以灵活地供用户选择多种多样的切分策略,进而达到更好的运算性能. 本文分享自华为云社区<GES超大规模图计算引擎HyG揭秘之图切分& ...

  6. Solon 1.6.34 发布,更现代感的应用开发框架

    相对于 Spring Boot 和 Spring Cloud 的项目 启动快 5 - 10 倍 qps 高 2- 3 倍 运行时内存节省 1/3 ~ 1/2 打包可以缩小到 1/2 ~ 1/10(比如 ...

  7. VMware NAT 模式 虚拟机网络电缆被拔出,连不上网

    检查服务 VMnetDHCP,VMware NAT Service 服务是否已启动,启动后可以正常使用网络

  8. 敏捷编辑器Sublime text 4中文配置Python3开发运行代码环境

    敏捷编辑器Sublime text 4中文配置Python3开发运行代码环境 首先来到Win11环境下,进入Sublime text 4官网的下载页面:https://www.sublimetext. ...

  9. OLAP引擎也能实现高性能向量检索,据说QPS高于milvus!

    更多技术交流.求职机会,欢迎关注字节跳动数据平台微信公众号,回复[1]进入官方交流群 随着LLM技术应用及落地,数据库需要提高向量分析以及AI支持能力,向量数据库及向量检索等能力"异军突起& ...

  10. 玩转Python:处理图像,两个非常重要的库,很实用,附代码

    在Python中,图像处理是一个涉及图像分析.编辑和处理的广泛领域.有几个流行的库通常用于处理图像,每个库都有其特殊的功能和优势.以下是一些常用的Python图像处理库: 1. Pillow (PIL ...