Sun GC maxtenuringthreshold
Have a question about Sun GC. The Sun FAQ (old one for 1.4.2) says that the throughput collector does not use the MaxTenuringThreshold (MTT) parameter. Its used only for CMS. http://java.sun.com/docs/hotspot/gc1.4.2/faq.html
(12) What should I do if my application has mid- or long-lived objects?
- Objects that survive a young generation collection have a copying cost (part of the algorithm for a young generation collection is to copy any objects that survive). Mid- or long-lived objects may be copied multiple times. Use the -XX option MaxTenuringThreshold to determine the copying costs. 开发者_运维知识库Use -XX:MaxTenuringThreshold=0 to move an object that survives a young generation collection immediately to the tenured generation. If that improves the performance of the application, the copying of long-lived objects is significant. Note that the throughput collector does not use the MaxTenuringThreshold parameter.
I dont know how to verify this, but if its true, how does the throughput collector determine when to promote the young objects to the tenured generation ? Is it done everytime the young generation fills up (in other words MTT = 0 ? ).
If you are talking about a modern (1.6.0) Sun GC, you can download the source code and work out for yourself exactly what is going on. But of course, the behavior could change with different patch levels.
Here are some more recent documents that refer to the -XXmaxTenuringThreshold option:
- Java Tuning White Paper - Sun (2005)
- "The most complete list of -XX options for Java 6 JVM" - Eugene Kuleshov (2006)
and various hints show up in Google searches. But I cannot find any definitive documentation or a definitive answer to your question on the web.
Checking OpenJDK 1.6 source code for psScavenge.cpp (= -XX:+UseParallelGC
= throughput collector) we find
if (AlwaysTenure) {
_tenuring_threshold = 0;
} else if (NeverTenure) {
_tenuring_threshold = markOopDesc::max_age + 1;
} else {
// We want to smooth out our startup times for the AdaptiveSizePolicy
_tenuring_threshold = (UseAdaptiveSizePolicy) ? InitialTenuringThreshold :
MaxTenuringThreshold;
}
In this case (OpenJDK 1.6), MaxTenuringThreshold
is not used only when -XX:+UseAdaptiveSizePolicy
is activated. Then, a default initial value of 7 is used instead.
IMHO, the sentence in bold does mean JDK 1.4.2 will use a default/calculated maximum value to determine when to promote young objects.
If you want to check the values, you can use -XX:+PrintTenuringDistribution
Desired survivor size 48286924 bytes, new threshold 10 (max 10)
- age 1: 28992024 bytes, 28992024 total
- age 2: 1366864 bytes, 30358888 total
- age 3: 1425912 bytes, 31784800 total
精彩评论