• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Tomcat memory utilization question

Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>(ThreadPool.java:649)
at org.apache.tomcat.util.threads.ThreadPool.openThreads(ThreadPool.java:521)
at org.apache.tomcat.util.threads.ThreadPool.start(ThreadPool.java:150)
at org.apache.jk.common.ChannelSocket.init(ChannelSocket.java:436)
at org.apache.jk.server.JkMain.start(JkMain.java:370)
at org.apache.jk.server.JkCoyoteHandler.start(JkCoyoteHandler.java:144)
at org.apache.catalina.connector.Connector.start(Connector.java:1087)
at org.apache.catalina.core.StandardService.start(StandardService.java:534)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
... 6 more

Any help would be greatly appreciated.
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!