Maybe I overstated the "make sure" a bit but....

"cannot create native thread" but hey wait....You have pleanty of heap right? DOH, stack generally doesn't come out of the JAVA-side heap. So threads use BOTH heap and the "C side" of the Java process. Meaning the formula is something like:

Max # threads ~ (Max RSS Size - (Heap Size + Java Overhead + other C stuff like file handles and NIO stuff + Thread Local vars)) / StackPerThread

Which means that you are probably okay for small apps. Large apps that start > say around 2000 threads and use a lot of TLVs you're going to hit "cannot create native thread"

512k is a pretty big stack! Many server side apps aren't very recursive or method deep (calls come out of the stack obviously). So if I see "cannot create native thread" and maybe an OOME and yet I've got pleanty of heap...its probably stack vs process size. Most server apps are safe with a 128k stack which means I get a factor of 4x more threads minus entropic factors and part of the Thread object of course does come out of the Java heap.

Anyhow, I never get a chance to do formal benching so I'm not sure what the exact numbers are with all equal factors, I usually only have time to solve the critical problems then move to the next place. Note that one is about Sun's VM and the -XX:ThreadStackSize is a Solaris thing (-Xss only makes it bigger but it ignores it being smaller), but it seems recent versions of the Linux VM allow it too (but -Xss seems to let you make it smaller anyhow on Linux). Does that make sense?

-Andy

Michael Czeiszperger wrote:

On Jul 12, 2005, at 1:19 PM, [EMAIL PROTECTED] wrote:

5. Make sure you reduce -XX:+ThreadStackSize and -Xss so that you do not get 512k-1M stack per thread (generally excessive, but these are the defaults for -server on 32 and 64bit respectively)


Many thanks for the detailed suggestions. Could you please elaborate on the effects of this?

________________________________________________________________________ _________ Run, run, run, as fast as you can. You can't catch me, I'm the stinky cheese man!
        -- michael at czeiszperger dot org, Chapel Hill, NC



_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org



_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to