Question

I'm about to deploy several grails apps on top of a single Tomcat server, and I have the following doubts:

  1. In terms of memory usage: Does it make a difference to put the common grails libs under shared/lib instead of putting them in each app's war files? Is there a list of those jars ?
  2. If so, is there a mechanism not to package those jars in the war file for the "production" environment? I'm using NetBeans 6.7.
  3. I'm about to use Tomcat 5.5; are there any experiences that recommend to use 6.0 instead?

Thanks

Was it helpful?

Solution

I think best practices are to keep the libraries in the war, because if you update a library that's shared then you have make sure it's compatible with all of your apps that are using it. We do this with grails and with spring in general that way we don't have to go back and do compatibility testing each time we upgrade.

Also I believe that tomcat loads an instance of the class per application so you don't save on memory by using it as a common class.

See also:

Does Tomcat load the same library file into memory twice if they are in two web apps?

OTHER TIPS

1) putting the jars in shared/lib or common/lib might reduce the amount of memory required in PermGen. IMHO the greatest advantage is that uploading the war file is much more faster. But keep in mind, what TripWird said, shared jars ties all the deployed apps to the same grails version. Upgrading becomes a "nothing-or-all" game.

2) if you use

grails prod war --nojars

then all jar file are excluded from the war.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top