This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Virtual hosts and shared libraries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Virtual hosts and shared libraries" Watch "Virtual hosts and shared libraries" New topic

Virtual hosts and shared libraries

Fedor Smirnoff
Ranch Hand

Joined: Apr 21, 2003
Posts: 45
I got a problem with Tomcat using a huge amount of memory on startup. Of course I realize that it all depends on how large are the applications. However, I have lets say two identical machines with Tomcat 5.5 installed.
One Tomcat has 100 virtual hosts running the same application and takes up 400MB of ram after it finished loading, second Tomcat has 300 identical applications but deployed under localhost and it uses only 200MB of ram after loading. Can somebody explain me what is the case here? Does it mean that virtual hosts load all libraries in shared directory for every host into memory but all application running under localhost, simply load them once? I am a bit lost, I need to figure something out to cut down on memory use, any ideas? All users are running same application, application specific classes are in its own application WEB-INF/classes and all libraries needed to run the application, like struts and hibernate and so on are in tomcat/shared. Thank you.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

I'm not sure about your original question but..
Is it possible that the machine with 300 apps is using less memory because it reached the threshold that would trigger garbage collection (GC) where the machine with 100 apps hasn't?

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Fedor Smirnoff
Ranch Hand

Joined: Apr 21, 2003
Posts: 45
Actually I watch the memory grow as tomcat is starting up, the memory is growing as applications being loaded, so its not an issue with garbage collection
I agree. Here's the link:
subject: Virtual hosts and shared libraries
It's not a secret anymore!