JVM Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
Thread Test on HotSpot 1.7
This section provides a tutorial example to see how many running threads can be supported on HotSpot 1.7.0_45 Client and Server JVMs.
This test of CrashThread.java is done with HotSpot Client JVM 1.7.0 on my Windows 7 system.
herong> \Progra~1\java\jdk1.7.0_45\bin\javac CrashThread2.java herong> \Progra~1\java\jdk1.7.0_45\bin\java -Xmx2m CrashThread2 64 Time Threads T.Memory F.Memory 8:07:32 PM 1 1984 1563 8:07:32 PM 2 1984 1563 8:07:32 PM 3 1984 1563 ... 8:07:32 PM 62 1984 1509 8:07:32 PM 63 1984 1509 8:07:32 PM 64 1984 1509
There is no problem for HotSpot Client JVM to support for 64 running threads. However, when I look at the Task Manager, I noticed that the JVM is taking 99% of CPU time and 7,348K of memory. And my computer becomes slow.
Then I increased # of threads to higher values, I observed the following on system Task Manager:
HotSpot Client JVM 1.7.0_45 Threads CPU Memory System 64 99% 7,348K slow 128 99% 9,488K slow 256 99% 13,696K slow 512 99% 22,392K very slow 1024 99% 39,700K very slow 2048 99% 73,256K extremely slow
I repeated the same test on HotSpot Server JVM 1.7.0_45 and observed similar results:
HotSpot Server JVM 1.7.0_45 Threads CPU Memory System 64 99% 8,712K slow 128 99% 10,800K slow 256 99% 14,988K slow 512 99% 23,700K very slow 1024 99% 40,992K very slow 2048 99% 75,333K extremely slow
Table of Contents
JVM (Java Virtual Machine) Specification
Java HotSpot VM - JVM by Oracle/Sun
java.lang.Runtime Class - The JVM Instance
java.lang.System Class - The Operating System
ClassLoader Class - Class Loaders
Class Class - Class Reflections
JVM Stack, Frame and Stack Overflow
►Thread Testing Program and Result
CrashThread2.java - Thread Testing Program
Thread Test on HotSpot 1.4 and JRockit 7.0
CPU Impact of Multi-Thread Applications
I/O Impact of Multi-Thread Applications
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