<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>Sorry but this thread looks like a train wreak about to happen with everyone shouting.. FASTER... FASTER..... FASTER!!!! :-)</div><div><br></div><div>First a call to System.gc() will *always* result in a Full GC being executed. The call to System.gc() is synchronized which means that is multiple threads call it, the will be blocked waiting for the previous call complete.</div><div>Second, hooking things up to the JVMPI can result in a much slower runtime, it can alter/prevent future optimizations.</div><div><br></div><div>IMHO, what is really needed here is an understanding of *why* your applications transactional rates are so slow and *why* you're having difficulties with GC. IME, many of the problems you describe are more easily addressable with memory tuning. This goes beyond just a technical tuning of the JVM. It will involve analyzing how your application uses (and in this case abuses) memory. Try object creation statistics via NetBeans memory profiler.. or if you like to spend money to get the same information, get a copy of YourKit (a great tool that does do a wee bit more than NB profiler). Worst you could do it force a heap dump (jmap) on your production machine and do a census of what's in it.</div><div><br></div><div>Finally, technical tuning requires that you look at GC logs. I collect GC logs as a hobby so if you happen to produce one from your production system (negligible performance penalty to turn on gc logging) send it along and I'm happy to take a look let you know what I see.</div><div><br></div><div>Kind regards,</div><div>Kirk Pepperdine</div><div><br></div><div><br><div><div>On Dec 13, 2011, at 8:10 AM, Li Li wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">thanks.<div>is there any resources about writing tools communicating with JVM using JVMTI?<br><br><div class="gmail_quote">On Tue, Dec 13, 2011 at 11:51 AM, Krystal Mok <span dir="ltr"><<a href="mailto:rednaxelafx@gmail.com">rednaxelafx@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><div>The GC start/end events in JVMTI are available since a long time ago. You can use it in JDK 6 right now. [1] And in OpenJDK 7, too.</div>
<div><br></div><div>The problem (for you) is this interface does not allow you to execute any Java code in the event callback. You'll need make some non-Java interface in your dispatcher so that this notification can ultimately propagate from the JVM in full GC to your dispatcher.</div>

<div><br></div><div>- Kris</div><div><br></div><div>[1]: <a href="http://docs.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#GarbageCollectionStart" target="_blank">http://docs.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#GarbageCollectionStart</a></div>

<br></div><div class="gmail_quote"><div class="im">On Tue, Dec 13, 2011 at 11:40 AM, Li Li <span dir="ltr"><<a href="mailto:fancyerii@gmail.com" target="_blank">fancyerii@gmail.com</a>></span> wrote:<br></div><div>
<div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That's what I want.<div>btw, this feature is only available in sun jdk7? </div><div>does it exist in openjdk7?<div><div></div><div><br><br><div class="gmail_quote">On Mon, Dec 12, 2011 at 11:06 PM, Stefan Karlsson <span dir="ltr"><<a href="mailto:stefan.karlsson@oracle.com" target="_blank">stefan.karlsson@oracle.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>On 12/11/2011 07:31 AM, Li Li wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
hi,<br>
    In our application of full text searching with lucene and solr. we will give jvm about 25GB memory. we use CMS as old generation garbage collector. But the jvm sometimes can't do anything. So our clients complain that the connection is time out. we find the reason is the jvm is doing full gc and it will stop service for about 1-3 seconds.<br>



    I know that this situation is inevitable when using CMS collector. but we have more than one searching machines, so if I know jvm is doing full gc(specially stop the world), I can send requests to other machines. But the question now is that jvm don't provide an api for that. I think it's not very difficult(for guys developing hotspot, but is in deed difficult for me ). So I want your help.<br>



    The first question is where is the position of CMS full gc.<br>
    from <a href="http://blogs.oracle.com/jonthecollector/entry/did_you_know" target="_blank">http://blogs.oracle.com/<u></u>jonthecollector/entry/did_you_<u></u>know</a><br>
    there are many steps:<br>
      1. STW initial mark<br>
      2. Concurrent marking<br>
      3. Concurrent precleaning<br>
      4. STW remark<br>
      5. Concurrent sweeping<br>
      6. Concurrent reset<br>
    there are 2 stop the world stages. I want to know the line number(or functions) of this stages. so I can tell java program that jvm now is doing full gc.<br>
     The second is that how to communicate between jvm and java program? My expected thing is like :<br>
     //java program<br>
     if(System.isStopTheWolrd()){<br>
           //system is busy, tell the dispatch node that don't send request to me<br>
     }else{<br>
           do service;<br>
     }<br>
     I have no experience in jvm developing. jvm is implemented in c and jni is the interface between them. is there any other method that jvm can achieve this? obviously, it can extend System class and add a static method named isStopTheWorld(). Could some one tell me how to do this in details? Thank you very much.<br>



</blockquote>
<br></div></div>
You could probably use JVMTI. See: <a href="http://docs.oracle.com/javase/7/docs/platform/jvmti/jvmti.html#GarbageCollectionStart" target="_blank">http://docs.oracle.com/javase/<u></u>7/docs/platform/jvmti/jvmti.<u></u>html#GarbageCollectionStart</a><br>



<br>
StefanK<br>
</blockquote></div><br></div></div></div>
</blockquote></div></div></div><br>
</blockquote></div><br></div>
</blockquote></div><br></div></body></html>