3.JMM
A number of parameters affect generation size. (https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/sizing.html#heap_parameters) illustrates the difference between committed space and virtual space in the heap. At initialization of the virtual machine, the entire space for the heap is reserved. The size of the space reserved can be specified with the -Xmx
option. If the value of the -Xms
parameter is smaller than the value of the -Xmx
parameter, than not all of the space that is reserved is immediately committed to the virtual machine. The uncommitted space is labeled "virtual" in this figure. The different parts of the heap (tenured generation and young generation) can grow to the limit of the virtual space as needed.
Xmx
Xms
Xmn
-XX:SurvivorRatio 配置 Surviro区占Young区的比例
4.收集器
-
-XX:+UseParallelGC
默认情况下启用并行压缩 关闭的选项是-XX:-UseParallelOldGC
-XX:+UseConcMarkSweepGC
-XX:+UseG1GC
If the application has a small data set (up to approximately 100 MB), then
select the serial collector with the option -XX:+UseSerialGCIf the application will be run on a single processor and there are no pause time requirements, then let the VM select the collector, or select the serial collector with the option
-XX:+UseSerialGC
.If (a) peak application performance is the first priority and (b) there are no pause time requirements or pauses of 1 second or longer are acceptable, then let the VM select the collector, or select the parallel collector with
-XX:+UseParallelGC
.If response time is more important than overall throughput and garbage collection pauses must be kept shorter than approximately 1 second, then select the concurrent collector with
-XX:+UseConcMarkSweepGC
or-XX:+UseG1GC
.