<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Shyam,<div class=""><br class=""></div><div class="">For the benefit of the many G1 GC developers on this mailing list, (who can offer expertise and would like to hear your feedback) I am also posting information I also posted to jClarity.</div><div class=""><br class=""></div><div class="">I should also add that there are likely folks in this forum with extensive Java on SPARC experience.</div><div class=""><br class=""></div><div class="">I responded to Shyam’s post initially on jClarity since that is where it was posted first. For the others on this mailing list, here is my response that I had posted to on jClarity. Feel free to offer additional suggestions for Shyam.</div><div class=""><br class=""></div><div class="">1.) There are some high sys times with those high pause times. Possible causes could be swapping to virtual memory or if you are on Linux it could be transparent huge pages being enabled (on Linux you should disable transparent huge pages).</div><div class="">2.) -XX:LargePageSizeInBytes=256m implies you are on Solaris SPARC. Some Solaris SPARC platforms (i.e. T-series) are the only ones that I know of that support 256m pages. Are you running on Solaris SPARC ?<br class="">3.) Even with -XX:+ParallelRefProcEnabled there are still some rather high reference processing times. And, I also noticed you have SoftRefLRUPolicyMSPerMB=1 which implies the application is making heavy use of SoftReference and would like them to be processed more aggressively. These two observations makes me wonder what the application implementation looks like. Are there a very large number of SoftReferences in use in this application, and a large number of Reference objects in general in use? I am really curious what observation(s) drove you to set SoftRefLRUPolicyMSPerMB=1? And, also how the application is using Reference objects since the reference processing times are rather high even with ParallelRefProcEnabled.<br class="">4.) Also curious what observation(s) drove you to set G1ReservePercent=15?<br class="">5.) Lastly, what observation drove you to set HeapRegionSize=32m? With a 6 GB Java heap, at 32m region size, you have but just 192 regions for G1 to work with. The default number of regions is 2048. <br class="">6.) Ooh almost forgot, back to the 256m pages, (that is if you are on SPARC where it is supported). When a new (256m) page is touched during GC, that (256m) page will be zero'd which can introduce a small, but noticeable jump in pause time on those GCs where a new (256m) page is first touched. To work around that you add -XX:+AlwaysPreTouch to touch all pages at JVM launch time. I would not add that command line option just yet since you have some bigger issues going on here.<br class=""><br class=""></div><div class="">Let’s now take each of these a bit further.</div><div class="">- 256m pages</div><div class="">You have offered that you are indeed running on Solaris SPARC where 256m pages are a viable option. One possible explanation for the larger than usual spikes in GC times could be the result of large page coalescing at the next 256m page touch. The observation of high sys times on those GCs tend to support that hypothesis. You could help address this issue by adding -XX:+AlwaysPreTouch to the command line options. This would touch all pages at JVM launch time, but it will increase JVM initialization time.</div><div class="">- 32 MB region size</div><div class="">You offered that the reason you did this was to accommodate large sized array objects. As I have mentioned, a region size of 32 MB leaves just 192 regions for G1 to work with. The target number of G1 regions is 2048. In more recent JDK releases, there have been changes introduced to help address frequent large object allocations. So the more recent the JDK release you can work with, the better. So if you can migrate to the latest Java 8 JDK, that should improve your experience with G1.</div><div class=""><br class=""></div><div class="">Now continuing on …</div><div class=""><br class=""></div><div class="">For a next step, I think it would be good exercise to simplify your command line options and build up to the ones you can benefit from by running a sequence of experiments where you can compare the performance and behavior of the application to a baseline, where you started, and comparing one change at a time to that baseline until you find the best experience. That way you will have justification for each of the command line options.</div><div class=""><br class=""></div><div class="">Below I have listed out each of the command line options you are using along with a comment of whether I think it useful as a good starting place.</div><div class=""><br class=""></div><div class="">Your JVM command line options and my comments:</div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">-d64 </span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* You should not need to specify this since you are working with a 64-bit JVM.</font></span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">-server </span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* You do not need to specify this since 64-bit JVMs are -server JVMs only.</font></span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">-Xms6g -Xmx6g</span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">* These two are fine, assuming you have sufficiently enough available physical memory.</span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">-XX:PermSize=2g -XX:MaxPermSize=2g</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* These two are fine so long as you need that much memory for perm gen. GC logs will offer this info on Full GC events, and at JVM exit if you use -XX:+PrintGCDetails or you are logging to a GC to a log file. You can also monitor with Console to observe Perm Gen occupancy. You might want to double check that you need this much space since it is a bit higher than commonly seen.</font></span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">-XX:+</span><u style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class=""></u><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">HeapDumpOnOutOfMemoryError</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* This one is ok. It should not have a negative or positive performance advantage, and having a heap dump on an OutOfMemoryError can be useful and you have sufficient file system space for a potential heap dump.</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX+DisableExplicitGC</font></span></div><div class=""><font color="#222222" face="arial, sans-serif" size="2" class=""><span style="background-color: rgb(255, 255, 255);" class="">* This one is ok, assuming you do not have a need for a timely compaction of the Java heap.</span></font></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:+UseG1GC</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* I wonder if you need this one. You have a pause time target of 2 seconds (2000 ms). You might be able to reach that pause time target using -XX:+UseParallelOldGC. So, you might consider an experiment that compares the performance of ParallelOldGC versus G1GC.</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:MaxGCPauseMillis=2000</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* This one is ok if you are using G1 GC. If you use ParallelOldGC, then it is not needed.</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:</font></span><u style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class=""></u><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">InitiatingHeapOccupancyPer</span><wbr style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">cent</span><u style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class=""></u><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">=70</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Let experiments and analysis of the data drive you to tweaking it.</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:ConcGCThreads=12</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Let experiments and analysis of the data drive you to tweaking it.</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:G1ReservePercent=15</font></span></div><div class=""><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Let experiments and analysis of the data drive you to tweaking it.</font></span></div></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:1HeapRegionSize=32m</font></span></div><div class=""><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Let experiments and analysis of the data drive you to tweaking it.</font></span></div></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:-UseBiasedLocking</font></span></div><div class=""><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Let experiments and analysis of the data drive you to tweaking it. I suggest you use -XX:+PrintSafepointStatistics and look at the output to see if you are seeing a lot of biased lock revocation safepoints. You could also add -XX:+PrintApplicationStoppedTime to get a sense of non-GC stop the world events which could indicate non-GC safe points, some of which could be biased lock revocations.</font></span></div></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:LargePageSizeInBytes=256m</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Start with the defaults on Solars. HotSpot on Solaris will automatically try to use large pages, though I don’t recall if it will automatically try to use 256m pages out of the box. SPARC does support several different pages sizes. Again, let experiments and analysis of the data drive you to setting it. If you see similar behavior with spikes in pauses with G1 as you see now, then adding -XX:+AlwaysPreTouch should help. But, adding -XX:+AlwaysPreTouch will increase JVM initialization time.</font></span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small; background-color: rgb(255, 255, 255);" class="">-XX:-UseThreadPriorities</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not use this. You can try an experiment with explicit disabling of it to see if it helps. I doubt it will.</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:ParallelGCThreads=12</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Let experiments and analysis of the data drive you to tweaking it. Since SPARC has a large number of hardware threads, and you may be sharing this system with other applications, you may want to tweak this one.</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:SoftRefLRUPolicyMSPerMB=1</font></span></div><div class=""><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Suggest you not initially start with this command line option. Let experiments and analysis of the data drive you to tweaking it. When you start exploring whether to do something with the command line option, add -XX:+PrintReferenceGC so you can see how many SoftReferences are being processed per GC. If there is a large number of them, especially when your heap occupancy is high, then you can start looking at tweaking this one. If you have a lot of Reference objects to process, then you will also want to enable -XX:+ParallelRefProcEnabled.</font></span></div></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small; background-color: rgb(255, 255, 255);" class="">-XX:+ParallelRefProcEnabled</span></div><div class=""><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">* Based on your existing GC logs, this one is probably of use. You could however do a comparison run with it disabled to see what happens with GC pause times and in particular the reference processing phases.</font></span></div></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class=""><br class=""></font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">Here is what I would start with:</font></span></div><div class=""><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">-Xms6g -Xmx6g</span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class="">-XX:PermSize=2g -XX:MaxPermSize=2g *** Double check that you need Perm Gen this large by looking at GC logs or tracking the app behavior with JConsole or VisualVM</font></span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">-XX:+</span><u style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class=""></u><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);" class="">HeapDumpOnOutOfMemoryError</span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small; background-color: rgb(255, 255, 255);" class="">-XX+DisableExplicitGC</span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small; background-color: rgb(255, 255, 255);" class="">-XX:+UseG1GC</span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small; background-color: rgb(255, 255, 255);" class="">-XX:+ParallelRefProcEnabled</span></div><div class=""><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: small; background-color: rgb(255, 255, 255);" class="">-XX:+PrintReferenceGC</span></div><div class="">* NOTE: you should also add -XX:+PrintGCDetails and also one of the GC timestamps, i.e. -XX:+PrintGCTimeStamps or -XX:+PrintGCDateStamps. IIRC, you will get this information if you directing GC info to a log file.</div></div><div class=""><br class=""></div><div class="">As mentioned above, I would do a comparison with -XX:+UseParallelOldGC since your GC pause time target is pretty high. You may be able to meet that with a 6 GB Java heap. So, that would mean you swamp out -XX:+UseG1GC above and swap in -XX:+UseParallelOldGC. ParallelOldGC will offer you the best throughput. So, if it can meet your pause time target, it will give you better performance overall.</div><div class="">Once you have decided between G1 or ParallelOld GC, you can start looking at whether you can benefit from the other command line options. This is where you can start an experiment, one each for:</div><div class="">- With and without 256m pages, and separately, with and without -XX:+AlwaysPreTouch</div><div class="">- Test with -XX:+PrintSafepointStatistics to see if there are large number of biased locking revocation safepoints, this will tell you whether adding -XX:-UseBiasedLocking is helpful</div><div class="">- If G1 GC is the route for you and you want to, or have a need to further tune, then you have some data gathering and analysis to do. I would suggest to add -XX:+PrintAdaptiveSizePolicy to get information on large object allocations and their sizes. Looking at system performance will help you determine whether to tweak the default ParallelGCThreads and ConcGCThreads. </div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="arial, sans-serif" size="2" class=""><br class=""></font></span></div><div class="">hths,</div><div class=""><br class=""></div><div class="">charlie</div><div class=""> </div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 6, 2015, at 1:16 AM, Kirk Pepperdine <<a href="mailto:kirk@kodewerk.com" class="">kirk@kodewerk.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Hi Shyam,</span><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">You’ve already asked this question on my “friends of jClarity” list and I think you’ve gotten some excellent advice there from Charlie, Gil and a few others who are well regarded experts on this subject. I’d start with that advice first.</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Kind regards,</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Kirk Pepperdine</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><div class=""><div class="">On Jan 5, 2015, at 11:19 AM, megha shyam Jakkireddy <<a href="mailto:shyam21@gmail.com" class="">shyam21@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite" class=""><div class="">Hi</div><div class=""> </div><div class=""><p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="line-height: 13.800000190734863px; font-family: Arial, sans-serif; color: rgb(34, 34, 34); font-size: 9pt;" class="">Recently we have done some G1 Tuning. I've added a logfile. Could</span><span style="line-height: 13.800000190734863px; font-family: Arial, sans-serif; color: rgb(34, 34, 34); font-size: 9pt;" class=""> </span><span style="line-height: 13.800000190734863px; font-family: Arial, sans-serif; color: rgb(34, 34, 34); font-size: 9pt;" class="">somebody explain and let me know your thoughts to make it optimal. There were no full GC's observed, Heap adaptation looks good and however there were long pause times at the initial hours. And there were premature promotions as well<br class=""><br class="">Additional to the logging, we are using the below G1 parameters..</span></p><p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="line-height: 13.800000190734863px; font-family: Arial, sans-serif; color: rgb(34, 34, 34); font-size: 9pt;" class="">-d64 -server -Xms6g -Xmx6g -XX:PermSize=2g -XX:MaxPermSize=2g -XX:+HeapDumpOnOutOfMemoryError -XX+DisableExplicitGC -XX:+UseG1GC -XX:MaxGCPauseMillis=2000 -XX:InitiatingHeapOccupancyPercent=70 -XX:ConcGCThreads=12 -XX:G1ReservePercent=15 -XX:1HeapRegionSize=32m -XX:-UseBiasedLocking -XX:LargePageSizeInBytes=256m -XX:-UseThreadPriorities -XX:ParallelGCThreads=12 -XX:SoftRefLRUPolicyMSPerMB=1 -XX:+ParallelRefProcEnabled "</span></p><p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="line-height: 13.800000190734863px; font-family: Arial, sans-serif; color: rgb(34, 34, 34); font-size: 9pt;" class="">We are using JDK 1.7.0_45.</span></p><p class="MsoNormal" style="margin: 0in 0in 10pt;"><span style="line-height: 13.800000190734863px; font-family: Arial, sans-serif; color: rgb(34, 34, 34); font-size: 9pt;" class="">Regards</span></p><div style="margin: 0in 0in 10pt;" class=""><span style="line-height: 13.800000190734863px; font-family: Arial, sans-serif; color: rgb(34, 34, 34); font-size: 9pt;" class=""></span> <br class="webkit-block-placeholder"></div></div><span class=""><G1GC.TXT></span></blockquote></div></div></div></blockquote></div><br class=""></div></body></html>