The scalability of a JVM depends on:
– maximum memory
– maximum number of threads
– garbage collection
– a host of miscellaneous factors.
In this survey I look at the maximum number of threads. It shows that Linux is by far the superior Java platform followed distantly by Windows and then Mac OS X.
The test is included along with JVM and OS settings so you can confirm the numbers.
I focus on threads because it is one of the hardest things to pin down.
It is also important because:
– it tells you how many threads your app can support
– you can predict how long your app can run if it has thread leaks
Thread leaks are not as rare as they sound. Sun’s JMX Remoting library, which is now standard in JDK1.5 has a slow one, for example.
A Test
====
Download the attached thread-test.jar.
Standalone
———
This will tell you what you JVM can do if it is not doing anything else.
To run the test standalone:
java -jar thread-test.jar
or
java -cp thread-test.jar com.wotif.jaguar.threading.ThreadManualTest
e.g.
java -jar thread-test.jar 20000
20000 should exhaust most 32 bit VMs.
From your application
——————
The thread test gets much more interesting when run inside your app. Load your application up so that it is using its memory peak and then get it to call the thread test.
Call the main method in com.wotif.jaguar.threading.ThreadManualTest with 20000 as an argument.
Don’t be surprised if you can only create a few hundred threads!
Standalone Test Results By Operating System
============================
Mac OS X