Leonidas Papadakis wrote:
Greetings to all,
i have the following scenario. I want to deploy 5 apps that have exactly
the same classes (in jars). Only db access, static files and property
files change. In short all WEB-INF/lib jar files are the same. So the
question is : option1) If i put the jars under the common/endorsed
directory logically they will be loaded once in the jvm so that all the
applications will find them (common classpath). option 2) If i keep the
WEB-INF/lib structure for each web application then the classes will be
loaded for each application thus resulting in consuming more memory from
the jvm ? I think from my experience in the second scenario if i do not
put the jars in the WEB-INF folder the application does not start (of
course since the libs are not in classpath) ...
So is it better practice and probably performance wise to place all jars
to tomcat's directory ?
This has not been our practice. We often run separate instances of the
same webapp with only property/config files being different between the
instances.
Having to tear-apart each packaged war just to consolidate the
central/common .jar files just hasn't been worth it.
We keep each app instance (no matter how similar) as a separate
deployable web-application under Tomcat and don't attempt to "share"
common resources via Tomcat's central lib directory (or other mechanisms).
Now, as for the *effect* of that choice on our part... so far so good.
There's a disk-space hit, I suppose, in having duplicate copies of most
files/libs in each of the webapps. But, jeez, disk space is so cheap
and the file sizes are so small that (to us) it doesn't even merit concern.
As for JVM memory consumption, you might be right. Each tomcat webapp
gets its own classloader (in general a "very good thing") and I suppose
consolidating shared libs into Tomcat's common classloader might provide
some memory-consumption benefit. I've never looked into this so I can't
answer that definitively one way or the other. For us the answer is
still the same as the disk-space issue: I'd rather buy more memory than
start tearing apart my packaged webapps just to try and consolidate a
few libs and save a few megs. But that's us.
It's really an optimization choice. Do you want to optimize for
disk-space usage/memory usage, or do you want to optimize for ease of
build/installation?
We vastly prefer to optimize for ease-of-build/installation. Disk-space
and memory resources are far *less* precious than our own developer
time. But again, that's us.
- Gary
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]