S
Soeren Gerlach
Hello,
I've made some "interesting" experiences with a Java programm that
uses a high number of threads in respect to the memory requirement but
can't explain what's going on. Maybe someone other can shed some light
on this issue.
Currently I'm using the SUN JDK 1.5b2 on a linux 2.6 box. And YES: It
has all settings set (ulimit, kernel, etc.) to enable any user process
to launch up to 8000 threads/processes.
My program runs in one configuration with some 1500 threads. It uses
~750MB at peak. So I start the JVM with addition "-server -Xmx1G
-Xms1G" arguments which runs fine.
With another internal configuration the number of threads increased
upon start to 1800 and after creating _most_ of the threads the JVM
reported an out of memory error and crashed the Java program -
everthing upon start as I create all threads right at this point.
I tried to increase the memory using "-Xmx1500m -Xms1500m" setting but
now it got even worse: The JVM refused to create more then some 740
threads. Yikes! That was not, was I was expecting from increasing the
memory.
More astonishing: I reduced the memory to "-Xmx900m" and now it
started with 1800 threads.
VERY puzzling...This leaves me with a couple of unaswered questions:
1) What setting must I use to increase the memory to >1G and still be
able to launch >1800 threads? (It might happen now, that the 900M
isn't enough for the 1800 threads after some time).
2) What's the initial memory a thread consumes from main memory upon
creation?
3) Why does the number of threads increase when I decrease the memory?
Thanks a lot,
Soeren Gerlach
I've made some "interesting" experiences with a Java programm that
uses a high number of threads in respect to the memory requirement but
can't explain what's going on. Maybe someone other can shed some light
on this issue.
Currently I'm using the SUN JDK 1.5b2 on a linux 2.6 box. And YES: It
has all settings set (ulimit, kernel, etc.) to enable any user process
to launch up to 8000 threads/processes.
My program runs in one configuration with some 1500 threads. It uses
~750MB at peak. So I start the JVM with addition "-server -Xmx1G
-Xms1G" arguments which runs fine.
With another internal configuration the number of threads increased
upon start to 1800 and after creating _most_ of the threads the JVM
reported an out of memory error and crashed the Java program -
everthing upon start as I create all threads right at this point.
I tried to increase the memory using "-Xmx1500m -Xms1500m" setting but
now it got even worse: The JVM refused to create more then some 740
threads. Yikes! That was not, was I was expecting from increasing the
memory.
More astonishing: I reduced the memory to "-Xmx900m" and now it
started with 1800 threads.
VERY puzzling...This leaves me with a couple of unaswered questions:
1) What setting must I use to increase the memory to >1G and still be
able to launch >1800 threads? (It might happen now, that the 900M
isn't enough for the 1800 threads after some time).
2) What's the initial memory a thread consumes from main memory upon
creation?
3) Why does the number of threads increase when I decrease the memory?
Thanks a lot,
Soeren Gerlach