Tomcat 上的多个 Grails 应用程序
我即将在单个 Tomcat 服务器上部署多个 grails 应用程序,我有以下疑问:
- 在内存使用方面:将通用的 grails 库放在共享/lib 下而不是放在每个应用程序的战争文件?有这些罐子的清单吗?
- 如果是这样,是否有一种机制不将这些 jar 打包到“生产”环境的 war 文件中?我正在使用 NetBeans 6.7。
- 我即将使用 Tomcat 5.5;有没有推荐使用6.0的经验?
谢谢
I'm about to deploy several grails apps on top of a single Tomcat server, and I have the following doubts:
- 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 ?
- 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.
- I'm about to use Tomcat 5.5; are there any experiences that recommend to use 6.0 instead?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为最佳实践是让库保持在战争中,因为如果您更新共享的库,那么您就必须确保它与使用它的所有应用程序兼容。我们通常使用 grails 和 spring 来做到这一点,这样我们就不必在每次升级时返回并进行兼容性测试。
我还相信 tomcat 会为每个应用程序加载该类的实例,因此您不会通过将其用作公共类来节省内存。
另请参阅:
如果同一个库文件位于两个 Web 应用程序中,Tomcat 是否会将同一个库文件加载到内存中两次?
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?
1) 将 jar 放在共享/lib 或 common/lib 中可能会减少 PermGen 所需的内存量。恕我直言,最大的优点是上传 war 文件更快。
但请记住,TripWird 所说的共享 jar 将所有已部署的应用程序绑定到同一个 grails 版本。升级变成了“全无”的游戏。
2)如果你使用
那么所有jar文件都会被排除在war之外。
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
then all jar file are excluded from the war.