On 06.03.2012 18:21, Pid * wrote:
On 6 Mar 2012, at 08:16, "André Warnier"<a...@ice-sa.com> wrote:
Pid wrote:
On 06/03/2012 07:12, Rainer Frey wrote:
On 05.03.2012, at 14:14, Philippe ROUXEL wrote:
When I set JAVA_OPTS= -Xmx1024m -Xss75m
That means: each thread get a stack of 75MB. One of the following applies:
* the operating system has a limit on thread stack size
* the per process memory limit is reached before all initial tomcat threads are
started
* the system runs out of total memory before all initial tomcat threads are
started
75MB thread stack size seems quite insane, the default is around 1-2MB. Perhaps
you meant to set -Xms (which sets the initial Java heap size)?
75MB of stack is needed by hibenate to save the data aka a graph.
I haven't used hibernate personally, but I never heard anything like that. So
please elaborate. Where did you get that information?
Also what do you mean with "graph"? The graph of associated objects that are
updated by one hibernate call, or is your data actually graph data?
If so, how is that mapped? do you have any self-referential associations?
Is it really stack that you are talking about?
I'm also interested in the answers to these questions.
Ok, to get back to the OP's original question/assumption :
Assuming that "-Xss75M" tells the JVM to allocate 75 MB of memory for the stack of each
new thread created by the JVM, and noting that for a typical Tomcat instance, a minimum of about 10
threads seem to be created (with an additional one for each request being processed), this setting
of "-Xss75M" would mean that a minimum of 750 MB is being allocated for the threads'
stack.
Assuming on the other hand that this is a 32-bit system and JVM (the OP didn't
really say, but was mentioning Windows XP), where the maximum addressable
memory for a process is 4 GB (of which 1 GB more or less are used by the OS
itself); and considering the setting of -Xmx1024M for the Heap; and considering
that the rest of the JVM and Tomcat may use some 1024 MB by themselves (for
other things than the Heap and thread stacks);
Considering all this thus, it is not really so surprising that the OP would get
an OOM error at some point.
Noting on the other hand that the JVM stack should be mainly used to push and
pop subroutine/function parameters as they are being called, and that a
reasonable stack size seems to be around 512KB at most, this explains several
comments here which seem to put in doubt the wisdom of allocation 75 MB for the
stack of each Java thread.
75Mb is far too much for the thread stack size in a normal application.
I am not certain that it is necessarily fully allocated, just to
confuse matters further. I vaguely remember another discussion about
this, but can't find it in the archives.
By the way some slightly related anecdote: I once had to diagnose a
strange situation which at the end was explained by a user setting
ThreadStackSize to 2M. Note that the docs say ThreadStackSize is in K
(Kilo Bytes) and the code in fact does multiply the given value with
1000 (or 1024). So if you set ThreadStackSize to 2M verbatim you end up
configuring a stack size of 2GB :)
I forgot whether Xss also is in K or is in Bytes. Interpreting
ThreadStack Size in K and multiplying up all other units given in the
value IMHO is one of the most strange decisions done when designing JVM
flags.
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org