I ran a very simple thread creation benchmark on various vms to find out how 
useful my two processors were for java threads and this is what I get -

Benchmark ------------------------ Loop.java

class Loop implements Runnable {
    public static void main(String[] args) {
        for (int t = 0; t < Integer.parseInt(args[0]); t++)
            new Thread(new Loop()).start();

    public void run() {
        int i;
        for (i = 0; i < 10; i++)
                for (int j = 0; j < 1000000000; j++);

All this does is to create a number of threads specified on the command line 
and each thread runs the empty loop. I ran a test case with 8192 threads and 
32768 threads on linux 2.4.19-gentoo-r10 with two 1.7 Ghz Xeon with 1GB of 

time /opt/ibm-jdk-1.3.1/bin/java Loop 8192
0.870u 0.450s 0:09.95 13.2%     0+0k 0+0io 2921pf+0w
time /opt/blackdown-jdk-1.4.1_beta/bin/java -server Loop 8192
1.730u 1.530s 0:02.89 112.8%    0+0k 0+0io 2061pf+0w
time /opt/sun-j2sdk-1.4.0/bin/java -server Loop 8192
2.470u 1.790s 0:04.11 103.6%    0+0k 0+0io 2319pf+0w
time /opt/sun-jdk- -server Loop 8192
2.670u 1.680s 0:04.96 87.7%     0+0k 0+0io 2343pf+0w

time /opt/ibm-jdk-1.3.1/bin/java Loop 32768
1.980u 1.030s 0:10.96 27.4%     0+0k 0+0io 2933pf+0w
time /opt/blackdown-jdk-1.4.1_beta/bin/java -server Loop 32768
5.440u 5.940s 0:09.85 115.5%    0+0k 0+0io 2202pf+0w
time /opt/sun-j2sdk-1.4.0/bin/java -server Loop 32768
7.650u 7.130s 0:14.33 103.1%    0+0k 0+0io 2272pf+0w
time /opt/sun-jdk- -server Loop 32768
7.830u 6.730s 0:14.02 103.8%    0+0k 0+0io 2295pf+0w

I see that the IBM jvm gets the best performance, but has the most number of 
page faults. So the real world time is the highest. Can anyone explain this? 
Also why is the blackdown JVM so much better than the SUN JVM? Also if I use 
the client hotspot jvm, the performance just tanks completely. In most cases 
the test never finishes. Again does this mean that client side threading is a 
bad idea?

Thanks for any input
Naren Sankar

with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to