tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Crowther <peter.crowt...@melandra.com>
Subject Re: Max Thread/Memory problems with tomcat
Date Mon, 05 Oct 2009 17:47:12 GMT
2009/10/5 prashant sharma <psharma_ece@yahoo.com>:
> Tomcat: 5.0.

That's old, and no longer supported.  Why are you using this version?
(And exactly which version of 5.0 are you using, by the way?)

> OS: Windows Server HPC edition.

32- or 64-bit?  I ask because the maximum contiguous memory you'll get
in 32-bit is somewhere around 1400 Mbytes - the numbers vary depending
on exactly which Microsoft OS.

> JVM: 5.0

That's also old.  Why are you using this version?

> There is one basic doubt that I have. When we load/stress our Tomcat server, we hit thresholds
mentioned below once in a while. The root of the problem is that when I increase the clients,
I start getting a connection refused error on the server side. This is because the server
hits the maximum request processing thread limit. The other problems are connected to it:
>
> -Max threads (tomcat):
>
> As mentioned above, this is the root of the problem. To solve this problem, I increase
the max threads in server.xml. Then I get the Out of stack space exception.
>
> -Stack Memory:
>
> Now for this I tried a couple of things
> a) Reduce the stack size allotted per thread so that more threads can be spawned in the
allotted stack space.I believe that the default is around 320K/ thread. I set it to 128K in
the JVM options (Xss).
> b) Reduce the heap size. I did this because as per my understanding the memory alloted
to a process is divided among heap and stack. So probably reducing the heap size makes more
memory available for stack. Don't know if this is correct?

It certainly makes more memory available for the OS stack.

> Now once in a while I get Out of memory exception for heap space.
>
> -Heap Memory:
>
> Can somebody advise as to what are the solutions for these sort of problems other than
reducing the memory/thread consumption, of our application logic. I mean are there techniques
that can be applied on tomcat/JVM/OS level to make more threads/memory available to the tomcat
process?

OS: Use a 64-bit OS.  Add RAM to the server.  Use anything other than
32-bit Windows in order to get a larger contiguous heap space.  If you
absolutely have to use Windows, and it absolutely has to be the 32-bit
version, use the /3GB switch *with extreme care* - read up on
*exactly* what it does and what will break before enabling it.

JVM: You've done the main thing, which is to reduce the stack depth per thread.

Tomcat: Memory and CPU usage is generally better in newer versions.
Other tunings are very much application-specific, I suspect.

However, I think we all know what the underlying problem is: your
application will not reliably fit in the available space with the load
you're putting on it during the test.  Add more space, load-balance
onto multiple machines of the size you have, tune the app, or reduce
the scale of your load test if it's deliberately a long way above your
target load.

- Peter

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


Mime
View raw message