File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Tomcat memory utilization question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat memory utilization question" Watch "Tomcat memory utilization question" New topic

Tomcat memory utilization question

Jeremy Wilkinson

Joined: Mar 31, 2010
Posts: 13
I have been developing web applications, bundling as WAR's, and deploying to Tomcat version 6. My production server is configured to receive requests on a Apache server and redirect to Tomcat with AJP1.3. Aside from a few configuration changes to support higher volumes, virtual hosts, and different listener ports, I am baffled by the amount of memory being consumed at deployment or restart of my tomcat instance. I have 13 different web apps I would like to deploy on this Tomcat instance, but keep running out of memory when trying to deploy more than 9. I have increased the memory options to a max of 512m but am wondering if I am missing something or have configured something wrong because my test server Tomcat instance is configured with a 64m max and has all 13 apps deployed and starts just fine.

Can anyone point me in an direction that will help me better understand why 64 meg will allow for deployment of 13 web apps, but those same 13 will not deploy with an instance setup for 512 meg?

Also, I have created another instance to support the apps that I can not deploy on my primary instance but assume I will run into the same problem once I start adding more web apps to that one too. So I started setting up another instance of Tomcat and it will not start and fails with the following error.

Caused by: java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.<init>(
at org.apache.tomcat.util.threads.ThreadPool.openThreads(
at org.apache.tomcat.util.threads.ThreadPool.start(
at org.apache.jk.common.ChannelSocket.init(
at org.apache.jk.server.JkMain.start(
at org.apache.jk.server.JkCoyoteHandler.start(
at org.apache.catalina.connector.Connector.start(
at org.apache.catalina.core.StandardService.start(
at org.apache.catalina.core.StandardServer.start(
at org.apache.catalina.startup.Catalina.start(
... 6 more

Any help would be greatly appreciated.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
Have you used the Management App to check on how many request threads are running and the change in memory use?

That Thread problem sounds like you have a bunch of Threads that are hung somewhere - I had this happen when requests were waiting for a resource that was no longer available.

Jeremy Wilkinson

Joined: Mar 31, 2010
Posts: 13
Yes... I have watched the existing apps run in the manager and I have seen garbage collection work. Do you have any idea why one instance on one machine will work fine when deploying 13+ apps with a max heap of 64meg for memory, but those on another with 512 meg will not deploy those same 13 apps. The only difference really is the fact that I use AJP13 to connect my Apache web server to the Tomcat. Do you know anything about AJP holding threads?
I agree. Here's the link:
subject: Tomcat memory utilization question
It's not a secret anymore!