How to detect if the VM is running with compact refs from within the VM (no agent)?

Tom Rodriguez tom.rodriguez at oracle.com
Mon Apr 2 11:10:59 PDT 2012


> 
> The daily Lucene benchmark tests had suddenly a slowdown in query rate (queries to Lucene index per second, see http://people.apache.org/~mikemccand/lucenebench/IntNRQ.html - it went down after the commit of above code on March 18th). We were looking the whole day to find the issue (there was another possible commit on this day causing problems, but this one caused this). The interesting thing, by uncommenting the above code that retrieves the HotspotMXBream, the slowdown disappears.
>  
> Does getting the HotSpotDiagnosticMXBean somehow trigger some internal state in the virtual machine (e.g. attaching an agent lib), so this slows down hotspot a little bit?

My guess would be that it's really just a side effect of the class loading itself invalidating some optimization that's dependent on the class hierarchy.  Mostly the management stuff doesn't require change what the JVM does, except that there's a little extra data collection before and after GCs but that shouldn't be measurable I think.

I would see what's extra classes get loaded by your new logic and see if loading them directly affects performance, focusing on things in java.util first and then maybe java.lang.  You might also execute the new code in the middle of the run and look for compiles being made not entrant.  Combined with -verbose:class output you could see if that triggers the issue.

You might also take other benchmarks and see if the new code affects their performance.

tom

>  
> Uwe
>  
> -----
> Uwe Schindler
> uschindler at apache.org
> Apache Lucene PMC Member / Committer
> Bremen, Germany
> http://lucene.apache.org/
>  
> From: hotspot-compiler-dev-bounces at openjdk.java.net [mailto:hotspot-compiler-dev-bounces at openjdk.java.net] On Behalf Of Krystal Mok
> Sent: Wednesday, March 14, 2012 7:13 PM
> To: John Rose
> Cc: hotspot compiler
> Subject: Re: How to detect if the VM is running with compact refs from within the VM (no agent)?
>  
> Couldn't find these two fields in sun.misc.Unsafe (in JDK6u30), found arrayIndexScale(Class) and addressSize() methods instead.
> Experiment:  https://gist.github.com/2038305 
> Works as advertised. Thanks John! Learning new bits everday for me, too :-)
> 
> - Kris
> 
> On Thu, Mar 15, 2012 at 1:53 AM, John Rose <john.r.rose at oracle.com> wrote:
> On Mar 14, 2012, at 1:41 AM, Krystal Mok wrote:
> 
> 
> I'm not aware of any way to get the exact "reference size" (or "oop size" in HotSpot's terms). But it's possible to know whether compressed oops is in use or not. 
>  
> For some platforms, you could inspect sun.misc.Unsafe.ARRAY_OBJECT_INDEX_SCALE (= oopSize) and ADDRESS_SIZE (= wordSize).
>  
> — John
>  



More information about the hotspot-compiler-dev mailing list