tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arup Vidyerthy" <like_don...@yahoo.co.uk>
Subject RE: setting -Xss option and its impact on servlet threads
Date Wed, 27 Jul 2005 12:47:08 GMT
On Windows I believe it is 256K. Don't reduce it to 128K unless you are
absolutely sure what you are doing.

Also, sometimes when the JVM does run it trouble allocating stack correctly,
it may throw an exception (actually it may be an OutOfMemoryError) 'can't
create new native thread'.... It happened to us in our application when we
used the -Xss parameter to override the default stack size to 128K.

Regards...
Arup Vidyerthy


-----Original Message-----
From: Darryl L. Miles [mailto:darryl@netbauds.net] 
Sent: 27 July 2005 12:03
To: Tomcat Users List
Subject: Re: setting -Xss option and its impact on servlet threads


Peddireddy Srikanth wrote:

>  1) what is the default stack size for Sun JVM on windows (Win 2003 to 
>be more specefic)??
>  
>
Dont know.

>  2) Will this setting affect both normal threads and the servlet 
>threads created by tomcat?? or only normal threads?
>  
>
I believe there is a 1:1 corelation between all Java application threads, be
they Servlet or normal threads.  That is to say a Servlet thread uses
exactly 1 Java thread.

>  3) If I set that to, say 128K , and if some of my thread (servlet or  
>normal) needed more stack space than this in any case what happens 
>(obvious answer for this would be that thread execution would fail but 
>I want to know it from some one who experienced it)
>  
>
Are you able to change the stack size on a per Java Thread basis?

If the underlying JVM uses kernel level threads and stack arrangement in a
1:1 fashion (unlikely from the observations I've seen), an unmapped
page/area is usualy left at the end of the stack space if this is touched
(read or write) the application will get a terminal signal and the entire
JVM forced to exit just like it would accessing any other bit of invalid
memory.

However as JVM is a sandbox and it can know the amount of stack space a
method needs before its invoked it is completely possible for it to be able
to check/test its virtual Java stack has enough space left in the CPU
instruction stack as there does not need to be 1:1 to the Java execution
stack.  Its possible for a JVM to implement its Java code execution stack
completely within the operating system heap area.

I dont believe Java in general needs a large java execution stack as all
arrays are implemented as object allocations that come from the heap.  
So its not like the C language where you can have a few Kb byte array on a
whim, in Java it just has to store the pointers to that array as a local
variable in the java execution stack.


I would be very interested to understand how Sun's JVM application stack
works and its interactions with OS level threads,  stacks and address space
applications.

With platform level threads there is a clear trade off with thread stack
size and number of available threads, amount of available heap and number of
library / file mappings (when working with 32bit CPUs at least).  They all
squeeze each other for their bit of address space but in Java this does not
seem to be the case so much.

--
Darryl L. Miles



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


		
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message