Multi-Thread Process Running on JRockit JVM

This section provides a tutorial example showing how JRockit JVM behaves with CPU intensive processes running in multiple threads. JRockit gives much better total productivity and HotSpot JVM.

Now let's run MultithreadingCpuRunner2.java with JRockit R28.2.7:

Test 1 - JRockit JVM performs much better than HotSpot JVM:

C:\>"\Program Files\java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\javac"
   PrimeCalculator.java

C:\>"\Program Files\java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\javac"
   MultithreadingCpuRunner2.java

C:\>"\Program Files\java\jrockit-jdk1.6.0_45-R28.2.7-4.1.0\bin\java"
   MultithreadingCpuRunner2 1000 1 1 1 

Thread parameter: 1000
Number of threads: 1
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
26 | 1168 | 1168 | 1184
27 | 1184 | 1184 | 1184
28 | 1184 | 1184 | 1184
29 | 1181 | 1181 | 1184
30 | 1189 | 1189 | 1184
...

Test 2 - Total productivity of running 2 threads is in the expected range of (100+100)% CPU * 1184 = 2368.

Thread parameter: 1000
Number of threads: 2
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
108 | 1003 1001 | 2005 | 2033
109 | 1060 1059 | 2119 | 2033
110 | 1016 1015 | 2032 | 2033
111 | 1026 1022 | 2049 | 2033
...

Test 3 - Total productivity of running 3 threads is also in the expected range of (100+11+100)% CPU * 1184 = 2498.

Thread parameter: 1000
Number of threads: 3
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
34 | 828 804 822 | 2456 | 2450
35 | 870 777 811 | 2458 | 2450
36 | 784 836 820 | 2441 | 2450
37 | 825 755 877 | 2458 | 2450
38 | 853 804 797 | 2454 | 2450
...

Test 4 - Total productivity of running 4 threads is also in the expected range of (100+11+100+11)% CPU * 1184 = 2628.

Thread parameter: 1000
Number of threads: 4
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
173 | 625 598 625 670 | 2520 | 2559
174 | 674 660 616 596 | 2547 | 2559
175 | 628 689 698 659 | 2675 | 2559
176 | 706 645 627 624 | 2604 | 2559
177 | 628 629 641 631 | 2530 | 2559
...

Test 5 - Running 8 threads gives the same productivity level as 4 threads as we expected on my 2-CPU-4-Thread system.

Thread parameter: 1000
Number of threads: 8
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
46 | 310 169 618 128 393 111 521 203 | 2456 | 2455
47 | 371 176 483 177 461 101 532 156 | 2460 | 2455
48 | 400 198 561 162 348 140 531 110 | 2453 | 2455
49 | 359 166 480 147 503 111 498 186 | 2453 | 2455
...

Test 6 - Running 16 threads also gives the same productivity level as 4 threads as we expected on my 2-CPU-4-Thread system.

Thread parameter: 1000
Number of threads: 16
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
151 | 61 61 61 61 61 0 61 28 61 656 2 61 61 658 662 61 | 2626 | 2631
152 | 61 0 61 62 60 61 61 32 61 658 61 62 61 658 661 0 | 2632 | 2631
153 | 61 61 61 0 0 61 61 62 34 658 61 60 61 658 661 61 | 2632 | 2631
154 | 61 62 5 61 61 61 61 61 26 658 60 61 0 657 662 61 | 2630 | 2631
155 | 39 61 55 61 61 61 0 61 61 658 61 0 61 658 661 61 | 2631 | 2631
...

Test 7 - Surprisingly, running 32 threads gives much better productivity level than 4 threads. Where is the extra CPU power come from?

Thread parameter: 1000
Number of threads: 32
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
132 | 17 102 17 21 35 17 17 102 17 654 34 606 17 35 ... | 3135 | ...
134 | 37 329 36 31 18 36 36 123 36 345 18 600 36 18 ... | 3142 | ...
135 | 17 473 17 35 35 17 17 102 16 243 35 538 17 35 ... | 3150 | ...
...

Test 8 - Running 64 threads gives even better productivity level than 32 threads. But it takes noticeably longer to launch all 64 threads.

Thread parameter: 1000
Number of threads: 64
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
112 | 0 651 0 61 0 121 59 61 59 0 0 0 60 90 0 0 0 61 ... | 4375 | ...
113 | 0 648 59 46 59 59 0 0 0 61 59 59 0 117 0 0 60 0... | 4301 | ...
114 | 14 650 0 14 0 121 0 61 0 0 0 0 0 120 59 60 0 61... | 4385 | ...
...

Test 9 - Running 128 threads increases the productivity level again. Why? But it takes even longer to launch all 128 threads.

Thread parameter: 1000
Number of threads: 64
Monitoring interval: 1
Thread priority: 1
Seconds | Productivity per thread | Total | Average
...
27 | 59 0 59 0 59 0 59 0 59 59 57 180 59 0 16 0 0 58 ... | 4936 | ...
28 | 60 0 0 61 0 120 0 0 0 59 0 121 0 60 43 59 0 53  ... | 4968 | ...
29 | 60 59 0 0 59 121 0 60 59 60 0 120 0 0 61 0 59 6 ... | 4908 | ...

Conclusion:

Last update: 2014.

Table of Contents

 About This Book

 Downloading and Installing JDK 1.8.0 on Windows

 Downloading and Installing JDK 1.7.0 on Windows

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

 ClassLoader Class - Class Loaders

 Class Class - Class Reflections

 Sun's JVM - Java HotSpot VM

 JRockit JVM 28.2.7 by Oracle Corporation

 JVM Runtime Data Areas

 Memory Management and Garbage Collectors

 Garbage Collection Tests

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

CPU Impact of Multi-Thread Applications

 PrimeCalculator.java - CPU Intensive Process

 CPU Intensive Process - 1 Thread per CPU

 Single Thread Process on 2-CPU-4-Thread Machine

 Two-Thread Process on 2-CPU-4-Thread Machine

 Multi-Thread Process on 2-CPU-4-Thread Machine

 Multi-Thread Process Slows Down System Response Time

Multi-Thread Process Running on JRockit JVM

 I/O Impact of Multi-Thread Applications

 CDS (Class Data Sharing)

 Micro Benchmark Runner and JVM Options

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

 Micro Benchmark Tests in JIT Compilation Mode

 Micro Benchmark Tests on "float" and "double" Operations

 Outdated Tutorials

 References

 PDF Printing Version