Threads as a metric of the scalability of Java Virtual Machines – by Operating System

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

Published
Categorized as Java

By Greg Luck

As Terracotta’s CTO, Greg (@gregrluck) is entrusted with understanding market and technology forces and the business drivers that impact Terracotta’s product innovation and customer success. He helps shape company and technology strategy and designs many of the features in Terracotta’s products. Greg came to Terracotta on the acquisition of the popular caching project Ehcache which he founded in 2003. Prior to joining Terracotta, Greg served as Chief Architect at Australian online travel giant Wotif.com. He also served as a lead consultant for ThoughtWorks on accounts in the United States and Australia, was CIO at Virgin Blue, Tempo Services, Stamford Hotels and Resorts and Australian Resorts and spent seven years as a Chartered Accountant in KPMG’s small business and insolvency divisions. He is a regular speaker at conferences and contributor of articles to the technical press.