Re: [Ikvm-developers] Scala Fork-join-implementation - .net uses nearly 100% cpu, while running on
Brought to you by:
jfrijters
|
From: Andreas L. <and...@so...> - 2014-04-03 16:01:08
|
Hi Jeroen,
thanks for your help. Finally I found the problem - the semantic of Unsafe.park is different between the Sun JDK and the IKVM OpenJDK implementation.
The attached sample code illustrates the problem.
If you execute it under Sun java it will stop after printing "Hello"; if you run it via IKVM it will print "Hello World!" and return.
Best regards,
Andreas
public class TestUnsafe {
public static void main(String[] args) {
System.out.println("Hello");
sun.misc.Unsafe u = getUnsafe();
u.park(false, 0);
System.out.println("World!");
}
@SuppressWarnings("restriction")
private static Unsafe getUnsafe() {
try {
Field singleoneInstanceField = Unsafe.class.getDeclaredField("theUnsafe");
singleoneInstanceField.setAccessible(true);
return (Unsafe) singleoneInstanceField.get(null);
} catch (IllegalArgumentException e) {
} catch (SecurityException e) {
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
}
return null;
}
}
Von: Jeroen Frijters [mailto:je...@su...]
Gesendet: Donnerstag, 3. April 2014 06:42
An: Andreas Ländle; ikv...@li...
Betreff: RE: [Ikvm-developers] Scala Fork-join-implementation - .net uses nearly 100% cpu, while running on JVM doesn't add significant cpu load
Hi Andreas,
The Netbeans results probably aren't reliable for Unsafe methods, because these are implemented as HotSpot intrinsics.
What I meant was, is that this code is obviously specifically written for the Oracle JDK (by using the implementation specific sun.misc.Unsafe class) and hence it is not reasonable to expect it to perform well on IKVM.
Regards,
Jeroen
________________________________
From: Andreas Ländle <and...@so...<mailto:and...@so...>>
Sent: Wednesday, April 2, 2014 5:19 PM
To: Jeroen Frijters; ikv...@li...<mailto:ikv...@li...>
Subject: AW: [Ikvm-developers] Scala Fork-join-implementation - .net uses nearly 100% cpu, while running on JVM doesn't add significant cpu load
Hi Jeroen,
thanks, but to be honest I didn't fully understand the implications of your statement - I'm more a .net expert :-(
Also I'm not sure if this is related to my problem - since I wonder about the Hit count of the ForkJoinPool.scan method.
If I profile with Netbeans and instrumenting the Unsafe class I have only a small number of invocations. What I'm wondering about - no invocation of "putObject" at all.
Unfortunately I'm not able to instrument any of the scala.* classes in Netbeans (since netbeans couldn't handle the bytecode generated by the scala compiler?).
As already stated - I'm thankful for any hint; ' will try some new things tomorrow...
Best regards,
Andreas
Von: Jeroen Frijters [mailto:je...@su...]
Gesendet: Mittwoch, 2. April 2014 09:42
An: Andreas Ländle; ikv...@li...<mailto:ikv...@li...>
Betreff: RE: [Ikvm-developers] Scala Fork-join-implementation - .net uses nearly 100% cpu, while running on JVM doesn't add significant cpu load
>From the stack trace you can see that the scala forkjoin code uses sun.misc.Unsafe. That means it isn't a Java library, but a JDK specific library.
________________________________
From: Andreas Ländle <and...@so...<mailto:and...@so...>>
Sent: Wednesday, April 2, 2014 7:34 AM
To: ikv...@li...<mailto:ikv...@li...>
Subject: [Ikvm-developers] Scala Fork-join-implementation - .net uses nearly 100% cpu, while running on JVM doesn't add significant cpu load
Hello,
please excuse, if this isn't the right forum to discuss my problem.
I just played around with IKVM and the Akka Simple Cluster example (https://github.com/akka/akka/tree/master/akka-samples/akka-sample-cluster-java/src/main/java/sample/cluster/simple).
All went fine, but if I run the converted code on the .net runtime the CPU load is significantly higher.
As far as I can tell (from the .net profiling) the problem seems to occur inside the ForkJoinPool - but even after comparing this output with the one from the NetBeans Performace profiler of the original java program, I still have no idea want's wrong here.
So I hope there is somebody who can push me to the right direction - so that I'm able to understand the problem. Or maybe this is already something that is a problem that is common knowledge under IKVM users/developers?
How ever, thanks in advance for any hint.
Best regards,
Andreas Ländle
***************************************************************************
Soloplan GmbH
Software für Logistik und Planung
Burgstraße 20 | 87435 Kempten | Deutschland
Web: www.soloplan.de<http://www.soloplan.de>
Geschäftsführer: Wolfgang Heidl, HRB 5304 Kempten
|