I need some input on how to best tweak my memory settings to allow a higher number of threads.
I read through the posing on How many threads can a Java VM support? and followed the java example there (dieLikeaDog) and it does work, spawning just under 800 threads before dying.
As in the (dieLikeaDog example) link above, the code makes all the threads it can, until the following error results: java.lang.OutOfMemoryError: unable to create new native thread
Specifying Xss on the command line (e.g. java -Xss104k dieLikeADog) does not change the number of threads created.
I also tried changing -Xms and -Xmx and neither changed the number of threads it could produce.
The one thing that did change the number of threads is my -u ulimit (for max user processes). Making this larger did increase the number of threads.
my ulimits are as follows:
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 46588
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1024
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
I am a bit confused as I thought from reading other examples that specifying a smaller -Xss should increase the number of threads.
Is there something else going on that is stopping Xss from working?
In case it matters, I am running on a 64bit fedora 15 system (with 6 gigs of ram):
OS:
Linux
2.6.42.12-1.fc15.x86_64
amd64
JVM:
Sun Microsystems Inc.
Java(TM) SE Runtime Environment
Java HotSpot(TM) 64-Bit Server VM
1.6.0_27