The National Institute for Computational Sciences

Nautilus: What are the flags to prevent Java code from spawning excessive numbers of garbage collecting threads

When trying to run some java code (a statistical modeling code called maxent) for the Nimbios project on Nautilus, we were seeing that one instance of the code would spawn ~1200 threads. I thought initially that maxent was the culprit--until I ran a simple 'hello world' java program and it too spawned 1200 threads.

Turns out that the java virtual machine spawns garbage collecting threads in accordance with the number of processors that it detects. It also turns out that you can have a say in this process with the following flags:


Adding these flags when running the maxent code brought the thread count down to around 16, which seems to be around the baseline of the number of startup threads needed by the jvm. I think any java code run on Nautilus should benefit from using these flags. I haven't done any specific tests on how the value of ParallelGCThreads affects performance. At least with the maxent code, I did notice faster startup times for the jvm.