不知道是不是越老越不顶用了。。发现sun上面的两篇英文文档已经很难看懂了。。。 有兴趣的见文章最底部的介绍和链接
一。Maximum pause time goal 基于程序运行时,垃圾回收需要对程序暂停最大时间的控制
-XX:MaxGCPauseMillis=<nnn>
This is interpreted as a hint to the garbage collector that pause times of <nnn> milliseconds or less are desired. The garbage collector will adjust the Java heap size and other garbage collection related parameters in an attempt to keep garbage collection pauses shorter than <nnn> milliseconds. By default there is no maximum pause time goal. These adjustments may cause the garbage collector to occur more frequently , reducing the overall throughput of the application. In some cases the desired pause time goal cannot be met.
对于实时性比较高的系统往往不希望程序暂停在垃圾回收上。 另外这个策略看起来也可以加大回收次数频率。
二。throughput goal 基于程序吞吐量的垃圾回收策略控制
-XX:GCTimeRatio=<nnn>
Throughput is the percentage of total time not spent in garbage collection, considered over long periods of time. 这个吞吐量的意思就是在一段时间内,花费在非垃圾回收的时间上比例。
The ratio of garbage collection time to application time is
1 / (1 + <nnn>)
For example -XX:GCTimeRatio=19 sets a goal of 1/20th or 5% of the total time for garbage collection.
The time spent in garbage collection is the total time for both the young generation and old generation collections combined. If the throughput goal is not being met, the sizes of the generations are increased in an effort to increase the time the application can run between collections.
这个策略对整个系统的吞吐量应该能有一个提升。特别是在硬件资源足够的情况下。
p.s. 原文链接
==============================
第一个是介绍垃圾回收的原理
Tuning Garbage Collection with the 5.0 Java[tm] Virtual Machine
The young generation consists of eden plus two survivor spaces . Objects are initially allocated in eden.One survivor space is empty at any time, and serves as a destination of the next,copying collection of any live objects in eden and the other survivor space. Objects are copied between survivor spaces in this way until they are old enough to be tenured, or copied to the tenured generation.
第二个比较细节的介绍了jvm在不同机器上的表现机制,比如
Ergonomics in the 5.0 JavaTM Virtual Machine
In the J2SE platform version 5.0 a class of machine referred to as a server-class machine has been defined as a machine with * 2 or more physical processors * 2 or more Gbytes of physical memory On server-class machines by default the following are selected. * Throughput garbage collector * Heap sizes * initial heap size of 1/64 of physical memory up to 1Gbyte * maximum heap size of ¼ of physical memory up to 1Gbyte * Server runtime compiler
Java HotSpot VM Options 参数汇总
http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp